Visual Studio 2017 bin\roslyn files locked during build
Instead of killing the process manually, you may use the following commands in a Pre-Build Event:
tasklist /FI "IMAGENAME eq VBCSCompiler.exe" 2>NUL | find /I /N "VBCSCompiler.exe">NUL
if "%ERRORLEVEL%"=="0" (taskkill /IM VBCSCompiler.exe /F) else (verify >NUL)
UPDATE the Microsoft.CodeDom.Providers.DotNetCompilerPlatform package to V1.0.7
- Find Microsoft.CodeDom.Providers.DotNetCompilerPlatform from NuGet
Uninstall Old version
Install V1.0.7 or latest
Just open task manager and kill any instances of VBCSCompiler.exe. You don't even need to close Visual Studio.
A workaround is close VS, open task manager and kill any instances of VBCSCompiler.exe
(Thanks Tom John: https://developercommunity.visualstudio.com/content/problem/71302/binroslyn-files-locked-during-build.html)