I’ve had several situation with large solutions in VS2010 where assemblies get locked and references need to be constantly fixed, failing compilations. I would get errors when copying the DLL’s from the OBJ into the BIN folders, or even copying a schema assembly into the bin folder of the maps project which uses it. One “detail” (or not) was that the BizTalk and C# projects in the solution where upgraded from previous versions (BTS2004).
Using SysInternal’s Handle.exe tool, I found it was Devenv itself locking the assemblies.
I’ve tried several solutions that didn’t work, including:
- disable vs extensions
- stop windows indexing service
- make sure Copy Local is set to True in all the references
- the same fix that was used with VS2008+BTS2009 (documented here) of setting Private True in the project file;
- adding the the famous GenerateResourceNeverLockTypeAssemblies config in the project files (documented here, see Benson’s response).
What eventually solved the issue was a variation of the first solution Benson gave in the previous link, and which is documented here in a StackOverflow response by Godeke: code a small command line tool (VisualStudioLockWorkaround) that removes locks and which you add as a pre-build script to the troublesome VS projects. It’s ugly, but it solved my problem, after some hours of trying to figure out what was happening.