2
votes

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?

1
Did you find a solution for this problem? I am having exactly the same issue and I have already wasted a day trying to fix this issue?Hunter
Not completely. I seemed to have worked around the problem partly by re-creating some of the projects from scratch (and adding project references back). I did this with the theory that maybe some of the metadata in the .sln file was messed up.David Gardiner

1 Answers

2
votes

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:

  1. 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.

  2. 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:

  • To further analyze the build process, increase MSBuild verbosity: Tools > Options > Projects and Solutions > Build and Run > MSBuild project build output verbosity and set to Detailed or Diagnostic. This will help you in tracing build outputs nuances.