I have a large-ish Visual Studio 2010 solution (~110 C# projects). One project (let’s call it ‘A’) is a console application that has about 6 dependencies on other projects and some 3rd party assemblies.
If I build project ‘A’ it builds the dependencies as expected.
If I right-click on project ‘A’ and choose Debug | Start new instance, it first builds the project, and then proceeds to build a whole lot of other projects too. Watching the Output window, it’s like it keeps restarting the build process for each of these other project and their dependencies.
The problem is that the original project ‘A’ does not depend on these other projects (directly or indirectly) that Visual Studio is building before starting the debugger.
This means that it takes ages before the debugger is launched.
I have customised the .csproj files in some of the other projects but have not customised the ‘A’ project.
Command-line builds via msbuild all behave normally.
What would be causing Visual Studio to do this?
This is caused due to MSBuild’s reference-chain. Project A depends on Project B which depends on Project C, on so on.
You have couple of options:
By default new reference made in the current solution marked with
Copy Local=true. This process is one of the most time consuming during the build. Sometimes it makes sense to have only the topmost projects (.exe files) with the copy local property as lib projects don’t get run from their own output folder anyways.In the solution
Properties->Configuration Properties– by default each project is marked for build. You can uncheck unrelated projects from the build. This setting will be saved in the .sln file so just make sure you don’t check-in this modification – this may fail your CI builds.EDIT:
Tools>Options>Projects and Solutions>Build and Run>MSBuild project build output verbosityand set toDetailedorDiagnostic. This will help you in tracing build outputs nuances.