Allow MSBuild to clean and build solutions while open in visual studio
On every project we run we use PowerShell to drive build and deployments into our local environments.
We call MSBuild.exe from PowerShell but frequently get this error message: "CSC : error CS1606: Assembly signing failed; output may not be signed -- Error signing assembly -- The process cannot access the file because it is being used by another process."
The only way to work around this issue is to close visual studio, run our build and deploy scripts and reopen visual studio after.
Note: this is not a case that we are running MSBuild and trying to build or debug in Visual Studio. Often we haven't even compiled our code as we just changed an xml file value.
Visual studio should release all dll file locks as soon as a build, or debug session has finished. If we don't invoke a build or debug session in visual studio then there should be no file lock on the dlls at all.
Note: we are using VS2012 or VS 2010 with SharePoint tools, but I have witnessed this in none SharePoint projects also.
Scott Palmer commented
I get this because Visual Studio and MSBuild both want access to the .opensdf file. So command-line builds always fail if the project is opened in Visual Studio. Severely LAME.