Visual Studio 2015 locks DLL during debugging

后端 未结 4 931
鱼传尺愫
鱼传尺愫 2021-02-07 18:42

I have 3 C# projects A, B, and C. Both A and B reference C. The references to C from A and B are set to \"Copy Local\" implying that after C is built to C.dll (in the output dir

相关标签:
4条回答
  • 2021-02-07 19:06

    I had the same problem and none of the other recommended solutions I came across while searching the interwebs worked for me. Finally after "repairing" Visual Studio 2015 Enterprise, I tried launching Visual Studio in safe mode: devenv.exe /SafeMode

    In safe mode I was able to finally build my solution, and when I started again without the switch, I was prepared to shut off extensions one by one until I found which one was the culprit. Luckily that was unnecessary and subsequent builds went off without a hitch.

    0 讨论(0)
  • 2021-02-07 19:07

    I had the same problem. I changed my VS2015 settings and it seems the problem is gone:

    • disabled Options\Debugging\Edit and continue
    • -Options\Sourcecodemanagement from TFS to none-
    • -disabled Options\Debugging\Diagnostictools while debugging-

    Not sure wich one caused the locking, but i suspect the diagnostictools wich I did not have in VS2013. (The settings names I translated from German to english, don't know if it is exactly how they are called in english VS version.)

    Edit: As researched by Shea it was the Edit-And-Continue feature that locked the DLL.

    0 讨论(0)
  • 2021-02-07 19:18

    in my case this was "Panda free Antivirus" Who was watching on the dll of the "C" project and this caused the error: "the process cannot access the file because it is being used by another process"

    0 讨论(0)
  • 2021-02-07 19:18

    In my case, the .pdb file was locked. This is not the same as the .exe getting locked as it should be when debugging.

    Assuming it's just the .pdb, simply move it to a new folder (I dragged and dropped). Oddly enough, it cannot be deleted, but it can most certainly be moved! Once the .pdb file was gone, the assembly was able to compile again.

    The alternative solution (and probably the least convenient) involves closing out of the project entirely, then opening it again (the .pdb file magically unlocks!).

    Edit: After happening a second time, moving the file did not work; it appears restarting the project is the only reliable way to go.

    0 讨论(0)
提交回复
热议问题