MiguelSlv
MiguelSlv

Reputation: 15193

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

Upvotes: 6

Views: 5977

Answers (2)

Bao Nguyen
Bao Nguyen

Reputation: 129

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

Upvotes: 11

Martin H.
Martin H.

Reputation: 1106

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.

Upvotes: 20

Related Questions