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
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.
I had the same problem. I changed my VS2015 settings and it seems the problem is gone:
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.
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"
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.