locked
bin Directory in Project Won't Delete After First Build RRS feed

  • Question

  • User-691759321 posted

    I just finished upgrading NuGet packages in a large solution I am working on.  The project itself built fine and ran.  However, when I went to run the project a second time it gave several errors on build: (the ... is the path to the project)

    C:\Program Files (x86)\Microsoft Visual Studio\2017\Professional\MSBuild\15.0\Bin\Microsoft.Common.CurrentVersion.targets(4825,5): warning MSB3061: Unable to delete file "...\bin\roslyn\Microsoft.DiaSymReader.Native.amd64.dll". Access to the path '...\bin\roslyn\Microsoft.DiaSymReader.Native.amd64.dll' is denied.
    C:\Program Files (x86)\Microsoft Visual Studio\2017\Professional\MSBuild\15.0\Bin\Microsoft.Common.CurrentVersion.targets(4825,5): warning MSB3061: Unable to delete file "...\bin\roslyn\System.Diagnostics.FileVersionInfo.dll". Access to the path '...\bin\roslyn\System.Diagnostics.FileVersionInfo.dll' is denied.
    C:\Program Files (x86)\Microsoft Visual Studio\2017\Professional\MSBuild\15.0\Bin\Microsoft.Common.CurrentVersion.targets(4825,5): warning MSB3061: Unable to delete file "...\bin\roslyn\System.IO.Compression.dll". Access to the path '...\bin\roslyn\System.IO.Compression.dll' is denied.
    C:\Program Files (x86)\Microsoft Visual Studio\2017\Professional\MSBuild\15.0\Bin\Microsoft.Common.CurrentVersion.targets(4825,5): warning MSB3061: Unable to delete file "...\bin\roslyn\System.IO.FileSystem.Primitives.dll". Access to the path '...\bin\roslyn\System.IO.FileSystem.Primitives.dll' is denied.
    C:\Program Files (x86)\Microsoft Visual Studio\2017\Professional\MSBuild\15.0\Bin\Microsoft.Common.CurrentVersion.targets(4825,5): warning MSB3061: Unable to delete file "...\bin\roslyn\System.Security.Cryptography.Primitives.dll". Access to the path '...\bin\roslyn\System.Security.Cryptography.Primitives.dll' is denied.
    C:\Program Files (x86)\Microsoft Visual Studio\2017\Professional\MSBuild\15.0\Bin\Microsoft.Common.CurrentVersion.targets(4825,5): warning MSB3061: Unable to delete file "...\bin\roslyn\System.Text.Encoding.CodePages.dll". Access to the path '...\bin\roslyn\System.Text.Encoding.CodePages.dll' is denied.
    C:\Program Files (x86)\Microsoft Visual Studio\2017\Professional\MSBuild\15.0\Bin\Microsoft.Common.CurrentVersion.targets(4825,5): warning MSB3061: Unable to delete file "...\bin\roslyn\System.Xml.ReaderWriter.dll". Access to the path '...\bin\roslyn\System.Xml.ReaderWriter.dll' is denied.
    C:\Program Files (x86)\Microsoft Visual Studio\2017\Professional\MSBuild\15.0\Bin\Microsoft.Common.CurrentVersion.targets(4825,5): warning MSB3061: Unable to delete file "...\bin\roslyn\System.Xml.XPath.XDocument.dll". Access to the path '...\bin\roslyn\System.Xml.XPath.XDocument.dll' is denied.
    C:\Program Files (x86)\Microsoft Visual Studio\2017\Professional\MSBuild\15.0\Bin\Microsoft.Common.CurrentVersion.targets(4825,5): warning MSB3061: Unable to delete file "...\bin\roslyn\VBCSCompiler.exe". Access to the path '...\bin\roslyn\VBCSCompiler.exe' is denied.
    

    Here is my current setup:

    Microsoft Visual Studio 2017 Professional (15.2 r26430.14)

    Windows 10

    Chrome and IE11

    What I know is that it does not matter if I debug using Chrome vs. IE11.  The issues is corrected when I open the task manager and kill the VBCSCompiler.exe.  I get the errors on solution "clean".  Anyone know what this executable does or what could be triggering it?

    Wednesday, June 21, 2017 6:18 PM

All replies

  • User991499041 posted

    Hi Ddelella,

    What I know is that it does not matter if I debug using Chrome vs. IE11.  The issues is corrected when I open the task manager and kill the VBCSCompiler.exe.  I get the errors on solution "clean".  Anyone know what this executable does or what could be triggering it?

    Are you able to get a dump from the crashed Visual Studio instance? Sometimes Windows will create one depending on the version.

    That may help us isolate whether it is any of our interception components causing a crash.

    You may also want to clear out any temporary file locations, like the Temporary ASP.NET Files folders, just in case something odd is being cached somewhere.

    Regards,

    zxj

    Thursday, June 22, 2017 2:07 AM
  • User-691759321 posted

    The Visual Studio instance does not crash.  It just appears as an error in the Error List window that a file could not be deleted.  The files referenced are all in the program files folder with the folder name roslyn.  In order to clear the issue I have to stop the VBCSCompiler.exe task and then rebuild the solution.

    It is not an issue with temporary files.

    Thursday, July 6, 2017 2:20 PM
  • User-1050695194 posted

    Same issue for me with VS2017 on Win10. 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.

    Tuesday, July 25, 2017 2:30 AM
  • User-1072358429 posted

    Thank you Tnapster, 

    This solution work for me  as a project level, it is not working for VS 2017,

    Here is how it works for me since it is project based so it needs to be done as project level.

    For VS 2017. Once a new project initially created, do the same thing as Tnapster showed above In the 'Manage NuGET Packages' window I downgraded

    Here is my VS2017

    Microsoft.Net.Compilers to 2.3.1 (from 2.3.2) and also downgraded

    Microsoft.CodeDom.Providers.DotNetCompilerPlatform to 1.0.6 (from 1.0.7)

    Thursday, September 21, 2017 5:27 PM
  • User1222487963 posted

    Any idea what you can do if you have an existing project ported from VS2015 to VS2017?

    I don't have either of those packages in my nuget 'installed' list both at the solution NOR at the project level...

    Tuesday, December 5, 2017 8:54 PM
  • User753101303 posted

    Hi,

    And the bin path is correct,. I notice you have ...\bin rather than ..\bin (ie 3 dots rather than 2)

    Tuesday, December 5, 2017 9:47 PM