Search code examples
visual-studio-2017

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

Solution

  • 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