Access to SonarScanner.MsBuild.Common.dll is denied

Systems/resources used

  • SonarCloud
  • Sonar scanner MSBuild
  • Azure DevOps
  • Yaml pipelines

The error observed:

##[error]One or more errors occurred. (One or more errors occurred. (Access to the path 'C:\agent-a\_work\24\.sonarqube\bin\SonarScanner.MSBuild.Common.dll' is denied.)) (Access to the path 'C:\agent-a\_work\24\.sonarqube\bin\SonarScanner.MSBuild.Common.dll' is denied.)

steps to reproduce

The first build works, the second build fails with the error shown above.

In case of a follow-up, failing, build it is always a build that runs in the same working directory (e.g. _work\24\ in the error above).

It looks like the build is keeping a lock on the DLL file, even after it’s done. After a while, it seems to work again, but I haven’t figured out the time interval yet.

Before today I haven’t seen this issue and it’s also only occurring on 1 of our 28 projects. It could be related to the amount of builds this particular team runs close after each other.

Hi @AdeZwart

Can you try to add the /nr:false flag on your build command ?


I didn’t get any reports of this issue happening again, although I didn’t change that flag. I’ll consider it solved unless any of the teams report the issue again, in that case I’ll try the flag first.

This topic was automatically closed 7 days after the last reply. New replies are no longer allowed.