In my case it was the Explorer that was locking the DLL that was been compiled in the Debug folder... Strange, isn't it?
I found out using a tool called Unlocker.
Had to delete with Unlocker, even when it was saying that there was no lock over the file, and I couldn't delete the folder until I didn't delete that single file...
After that it compiled.
EDIT:
I found out why in my case this was happening. I had the DLL opened in a text editor inside Visual Studio...
Sometimes when you double click on a warning about the referenced assembly version mismatch between two or more projects you forget to close the assembly view window and it stays there among other tabs... so you end up with the assembly being locked by VS itself and it took me quite a lot of time to figure that out :)
Be careful with the power VS provides ;)
close all documents on VS and try to rebuild again. If it doesn't work restart VS. This problem is related to lock of DLL files.
I had the same issue. How I resolved it was:
Close visual studio, delete bin , debug release folder, and start visual studio project again. that fixed my problem
I am a developer and do not like apps injected to Registery like Unlocker.
I used SysInternals Process Explorer which process locked my dll Find > Find Handle or Dll [Ctrl-F]
and killed the process.
If you love us? You can donate to us via Paypal or buy me a coffee so we can maintain and grow! Thank you!
Donate Us With