开发者

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

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 ch开发者_如何学运维ange 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?


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.

0

上一篇:

下一篇:

精彩评论

暂无评论...
验证码 换一张
取 消

最新问答

问答排行榜