When I try to build my solution I often get this error:
Unable to copy file "obj\Debug\MyProjectXXX.dll" to "bin\Debug\MyProjectXXX.dll". The process cannot access the file 'bin\Debug\MyProjectXXX.dll' because it is being used by another process.
The project it's trying to build is a class library referenced by a couple of other projects in the solution.
1. Delete whatever files exist in obj/Debug (just files)
2. Add these two lines to the "Pre-build event command line" in the MyProjectXXX properties:
if exist "$(TargetPath).locked" del "$(TargetPath).locked"
if exist "$(TargetPath)" if not exist "$(TargetPath).locked" move "$(TargetPath)" "$(TargetPath).locked"
1. Build the project again.