Skip to content

Instantly share code, notes, and snippets.

@benvillalobos
Last active August 25, 2022 18:50
Show Gist options
  • Star 0 You must be signed in to star a gist
  • Fork 0 You must be signed in to fork a gist
  • Save benvillalobos/2b81e4bfba321a77ee39a9f1d6ef1b4a to your computer and use it in GitHub Desktop.
Save benvillalobos/2b81e4bfba321a77ee39a9f1d6ef1b4a to your computer and use it in GitHub Desktop.
Stop MSBuild From Holding Files

Stop MSBuild From Locking Files

Stop MSBuild from locking your files! Also, consider that the problem could be MSBuild or something your build is doing.

Note: Use Visual Studio Developer Command Prompt.

In Visual Studio

  1. set MSBUILDDISABLENODEREUSE=1
  2. devenv yourproject.csproj

In CLI

msbuild yourproject.csproj /nr:false

Killing MSBuild Processes

taskkill /im msbuild.exe

Here's a handy script I use to kill various .NET processes that tend to hold onto files.

taskkill /f /im msbuild.exe
taskkill /f /im dotnet.exe
taskkill /f /im vbcscompiler.exe
taskkill /f /im omnisharp.exe
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment