Can not delete \bin\roslyn\VBCSCompiler.exe - Access is denied

Same problem here - solution for me was closing VS, open task manager and end all instances of VBCSCompiler.exe as mentionend here: https://developercommunity.visualstudio.com/content/problem/71302/binroslyn-files-locked-during-build.html


In the 'Manage NuGET Packages' window I downgraded Microsoft.Net.Compilers to 2.3.0 (from 2.3.1) and also downgraded Microsoft.CodeDom.Providers.DotNetCompilerPlatform to 1.0.4 (from 1.0.5) and the Roslyn directory/files were no longer marked as readonly and no longer locked by the exe.


Goto Taskmanager --> under process tab ---> find VBCSCompiler.exe and end this task. then try to delete the folder


I accidentally found this in Task Manager:

Windows Explorer > (expand Windows Explorer) > Roslyn Right-click Roslyn and select End Task

Note: Even closing all Windows Explorer windows will not stop Roslyn. You must do this in Task Manager.