Reputation: 8351
I am running VS2017 version 26430.13 and every time I try to build a web project I get errors that access to the files in the bin\roslyn is denied. Over a period of about 5 minutes the files are unlocked and I can build but the 5 minute delay is unacceptable.
These are the files that stay locked:
Upvotes: 67
Views: 33856
Reputation: 435
Deleting this dll Microsoft.CodeDom.Providers.DotNetCompilerPlatform solved the issue for me
Upvotes: 1
Reputation: 580
In VS2017 & VS2019, this can happen when IIS Express is still running. Open the tray next to the clock, hover over the IIS Express icon running, right-click on the icon, click "Exit", confirm prompt, close active running worker processes. This can also be true when trying to publish your web project as well.
Upvotes: 1
Reputation: 1
I was having the same issue in MVC 5. I just opened Nuget Package Manager, searched and updated the following:
Microsoft.CodeDom.Providers.DotNetCompilerPlatform
Upvotes: 0
Reputation: 822
For me I just open solution in file explorer and delete bin folders of all projects in it. now it's working fine.
Upvotes: 1
Reputation: 9298
for me updating the nuget package...
Microsoft.Net.Compilers
to the latest at the time of this post 2.7.0 fixed this for me. it was version 1.3.2
Upvotes: 1
Reputation: 729
Project > Manage NuGet Packages... > Installed(tab) > in search input set this:
codedom
Upvotes: 7
Reputation: 1
In my case I did these two steps:
Upvotes: 0
Reputation: 267
Install Microsoft.CodeDom.Providers.DotNetCompilerPlatform.BinFix nuget It fixed the issue for me
Upvotes: 1
Reputation: 4761
UPDATE the Microsoft.CodeDom.Providers.DotNetCompilerPlatform package to V1.0.7
Upvotes: 79
Reputation: 2577
I have VS 2017 Enterprise and for me the issue was resolved by this:
Upvotes: 3
Reputation: 1
Update the Microsoft.CodeDom.Providers.DotNetCompilerPlatform
package to V1.0.6
Upvotes: -2
Reputation: 418
Microsoft.CodeDom.Providers.DotNetCompilerPlatform
package to V1.0.4
This advice came from a comment on the developer community problem report https://developercommunity.visualstudio.com/solutions/79954/view.html.
We were on v1.0.5 and experienced locked files frequently. After reverting the Microsoft.CodeDom.Providers.DotNetCompilerPlatform package to V1.0.4 we are no longer experiencing locked files.
Upvotes: 10
Reputation: 601
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)
Upvotes: 14
Reputation: 1567
Just open task manager and kill any instances of VBCSCompiler.exe. You don't even need to close Visual Studio.
Upvotes: 142
Reputation: 4297
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)
Upvotes: 10