Visual Studio 2017 bin\roslyn files locked during build

前端 未结 15 964
春和景丽
春和景丽 2021-01-30 03:53

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 mi

相关标签:
15条回答
  • 2021-01-30 04:34

    Instead of killing the process manually, you may use the following commands in a Pre-Build Event:

    tasklist /FI "IMAGENAME eq VBCSCompiler.exe" 2>NUL | find /I /N "VBCSCompiler.exe">NUL
    if "%ERRORLEVEL%"=="0" (taskkill /IM VBCSCompiler.exe /F) else (verify >NUL)
    
    0 讨论(0)
  • 2021-01-30 04:35

    Revert the Microsoft.CodeDom.Providers.DotNetCompilerPlatform package to V1.0.4

    This advice came from a comment on the developer community problem report https://developercommunity.visualstudio.com/solutions/79954/view.html.

    We were on v1.0.5 and experienced locked files frequently. After reverting the Microsoft.CodeDom.Providers.DotNetCompilerPlatform package to V1.0.4 we are no longer experiencing locked files.

    0 讨论(0)
  • 2021-01-30 04:35

    A workaround is close VS, open task manager and kill any instances of VBCSCompiler.exe

    (Thanks Tom John: https://developercommunity.visualstudio.com/content/problem/71302/binroslyn-files-locked-during-build.html)

    0 讨论(0)
  • 2021-01-30 04:35

    For me I just open solution in file explorer and delete bin folders of all projects in it. now it's working fine.

    0 讨论(0)
  • 2021-01-30 04:37

    Project > Manage NuGet Packages... > Installed(tab) > in search input set this:

    codedom
    

    click to update

    0 讨论(0)
  • 2021-01-30 04:39

    In my case I did these two steps:

    1. uninstall-package Microsoft.CodeDom.Providers.DotNetCompilerPlatform
    2. Install-Package Microsoft.CodeDom.Providers.DotNetCompilerPlatform -Version 1.0.8
    0 讨论(0)
提交回复
热议问题