Logo Questions Linux Laravel Mysql Ubuntu Git Menu
 

Access denied to roslyn folder when compiling MVC project in VS 2017

After a few debug sessions i can't compile the project anymore.

Compile gives several access errors like error below for some system assemblies, all related to roslyn bin folder:

error MSB3021: Unable to copy file ...\packages\Microsoft.Net.Compilers.2.2.0\tools\System.Collections.Immutable.dll" to "bin\roslyn\System.Collections.Immutable.dll". Access to the path 'bin\roslyn\System.Collections.Immutable.dll' is denied.

Restart to the VS doesn't solve. The project uses IIS express to run and there is no IIS express process running.

Only solution is reboot.

I am using VS2017, update 2

like image 906
MiguelSlv Avatar asked Aug 02 '17 16:08

MiguelSlv


2 Answers

I'm actually facing the same problem. In my case it was the VBCSCompiler.exe, which makes sense because "Roslyn" (found in the path name) is the internal name of the ".NET Compiler Platform". So I was able to solve the build problem by terminating this process.

But this is just a workaround. I still don't know why the process keeps running and keeps file handles after I stopped the debugging.

like image 75
Martin H. Avatar answered Jan 04 '23 00:01

Martin H.


Update Microsoft.CodeDom.Providers.DotNetCompilerPlatform to version 1.0.6 or latest. You refer to the link https://github.com/aspnet/RoslynCodeDomProvider/issues/10

like image 38
Bao Nguyen Avatar answered Jan 03 '23 23:01

Bao Nguyen