When starting a project for debugging, why does Visual Studio build the whole solution, not just the project?

In Visual Studio, if you select "Start Debugging" or "Start Without Debugging" to start the currently selected startup project, Visual Studio always creates the whole solution. This seems unnecessary, because all he really needs to do is build the project you want to run and its dependents.

If you have separate test projects, you cannot start the launch project until all of your unit test projects have been compiled. At the very least, it is a waste of time creating all these unit test projects, because the project you want to run will not depend on them anyway.

Can this behavior be changed?

+5
source share
2 answers

Yes, you can change this behavior (and I always do what you describe).

Go to Tools > Options > Projects and Solutions > Build and Run. then check the box "Only create run projects and Run dependencies".

+12
source

In my case, this has already been verified, but still not built. VS 2012 only built the main (launch) project, but not one of its dependencies. He found that due Active configurationto ConfigurationManagerit was found that only the Main project will be created (start).

Go to Build>ConfigurationManager

Make sure that all the projects you want to create are checked as in the screenshot below

enter image description here

+2
source

All Articles