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.
Thanks for taking the time to share this suggestion. This item has been around for a couple of versions of Visual Studio and we haven’t acted on it. Looking at the VS “15” plans, we’re not going to take action on this item, so we’re going to close it. If the suggestion is still relevant, please either take a look to see if there’s another suggestion that’s similar that you can vote on, or open a new suggestion.
- The Visual Studio Team
Rajat Nayyar commented
Kindly restart the Visual Studio, once again reload the Project and try Deploying.
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.