Logo Questions Linux Laravel Mysql Ubuntu Git Menu
 

Visual Studio 2017 bin\roslyn files locked during build

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:

  • Microsoft.CodeAnalysis.CSharp.dll
  • Microsoft.CodeAnalysis.dll
  • Microsoft.CodeAnalysis.VisualBasic.dll
  • Microsoft.DiaSymReader.Native.amd64.dll
  • System.Collections.Immutable.dll
  • System.Diagnostics.FileVersionInfo.dll
  • System.IO.Compression.dll
  • System.IO.FileSystem.dll
  • System.IO.FileSystem.Primitives.dll
  • System.Reflection.Metadata.dll
  • System.Security.Cryptography.Algorithms.dl
  • System.Security.Cryptography.Primitives.dl
  • System.ValueTuple.dll
  • VBCSCompiler.exe
like image 766
John S Avatar asked Jun 21 '17 17:06

John S


People also ask

Why is Roslyn folder in bin?

@Dmitry The job of the csc.exe in /bin/Roslyn is to invoke the VBCSCompiler.exe , which sits in the same folder. VBCSCompiler.exe is the process that does the actual compilation work. If the VBCSCompiler is already running csc.exe will reuse it and thus we will still gain the mentioned performance improvement.

Can I delete the Roslyn folder?

NET Compiler Platform, also known by its nickname Roslyn, is a set of open-source compilers and code analysis APIs for C# and Visual Basic languages from Microsoft. Deleting this cache folder will not affect Visual Studio, but it may affect the loading speed of . NET Compiler Platform (Roslyn) Analyzers.


2 Answers

Just open task manager and kill any instances of VBCSCompiler.exe. You don't even need to close Visual Studio.

like image 88
Dean Swiatek Avatar answered Oct 20 '22 13:10

Dean Swiatek


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
like image 44
sansalk Avatar answered Oct 20 '22 13:10

sansalk