In Visual Studio, how to make the incremental build just as fast the debug-session-triggered build?
Asked Answered
L

1

7

I have a Visual Studio 2010 solution with 40-ish projects in it (C# + one C++/CLI). I have Visual studio configured such that it builds the whole solution before starting debugging.

Now suppose I change the code for a 'leaf' project on which no other project depends. When I explicitly build the solution incrementally (F6 or F7), I see a build output line for each project in my solution. The up to date projects are not being recompiled though. For instance, you don't see warnings for the projects. It does take time (maybe 5-10 seconds).

Now suppose I change the same file again, and start debugging (F5). Now something different happens. Only the changed project is recompiled(takes 1 sec or so), and then debugging starts almost instantaneous.

It seems that Visual Studio has two strategies for incremental build, and the best optimized one seems to be available only as a by-product of a debugging session.

Question:

Is there a way to invoke this more optimized build strategy manually, without starting a debug session?

Literality answered 16/4, 2011 at 19:52 Comment(1)
@BoltClock: Oh, I guess that depends on the profile. I always choose the C++ keyboard scheme, there F7 is the incremental build. (Fixed the question)Literality
R
3

When you debug it only builds the project that is going to be debugged. When you build the solution, it builds all the projects in the solution. There are checks involved with each project even when nothing is actually compiled. These steps in the build process, even when no compilation action is taken, is why it takes longer to build the solution.

If you go into Tools->Options... and look under Projects and Solutions -> Build and Run there is setting called MSBuild project build output verbosity setting this to Normal or higher should give you some more insight into what is actually going on when you build vs debug. You will have to show the Output window and set that to show the Build output to see the information from that setting.

You can build the current project by pressing Shift+F6, this should have the same speed.

Rh answered 22/5, 2011 at 4:37 Comment(0)

© 2022 - 2024 — McMap. All rights reserved.