dotnet build is locking custom msbuild task dlls
See original GitHub issueDescription
We are providing a tool that needs to be called before the build and after the tests which synchronize some analyzers (with their rulesets…) from a central server and at the end pushes some code quality information back to the server.
To do so we are copying some targets and some tasks dlls inside a .sonarqube\bin
folder.
We have had a couple of complaints from our users on the different channels (StackOverflow, GitHub Issues, our community forum) about the fact the dotnet build
is locking some of our dlls.
When using only msbuild
we don’t have such behavior but when using dotnet build
or dotnet msbuild
then the failure starts appearing.
For example see https://github.com/SonarSource/sonar-scanner-msbuild/issues/535
We couldn’t find any easy way to prevent this behavior and before starting to try to hack around, we would prefer to have your input on what could be done.
Steps to reproduce
Example of commands:
dotnet tool install --global dotnet-sonarscanner
dotnet sonarscanner begin /k:"project-key"
dotnet build
dotnet sonarscanner end
Now if you do again the dotnet sonarscanner begin /k::project-key"
you end up with the message Access to the path 'SonarScanner.MSBuild.Common.dll' is denied
.
Known workarounds
- Kill dotnet process
- Use
/nodereuse:false
Issue Analytics
- State:
- Created 5 years ago
- Comments:5 (5 by maintainers)
Seems to me like this happens due to msbuild node re-use. we leave msbuild nodes alive with the intent of saving on startup time when doing consecutive builds.
You can turned it off by setting an environment variable:
MSBUILDDISABLENODEREUSE=1
or you can run `dotnet build-server shutdown after the build.Good to know if found out what is going on. No worries about the thread. Keep them coming.