Displaying build times in Visual Studio?

2019-01-04 18:01发布

Our build server is taking too long to build one of our C++ projects. It uses Visual Studio 2008. Is there any way to get devenv.com to log the time taken to build each project in the solution, so that I know where to focus my efforts?

Improved hardware is not an option in this case.

I've tried setting the output verbosity (under Tools / Options / Projects and Solutions / Build and Run / MSBuild project build output verbosity). This doesn't seem to have any effect in the IDE.

When running MSBuild from the command line (and, for Visual Studio 2008, it needs to be MSBuild v3.5), it displays the total time elapsed at the end, but not in the IDE.

I really wanted a time-taken report for each project in the solution, so that I could figure out where the build process was taking its time.

Alternatively, since we actually use NAnt to drive the build process (we use Jetbrains TeamCity), is there a way to get NAnt to tell me the time taken for each step?

12条回答
神经病院院长
2楼-- · 2019-01-04 18:25

Visual Studio 2012 till 2017

  • For MSBuild Projects (e.g. all .Net-Projects):
    Click Tools -> Options and then select Projects and Solutions -> Build and Run. Change MSBuild project build output verbosity to Normal. So it will display Time Elapsed in every Solution Project it builds. But there is unfortunatily no Elapsed Time Sum over all project. You will also see the Build started Timestamp

  • FOR C/C++ Project:

Click Tools -> Options and then select Projects and Solutions -> VC++ Project Settings.

Change Build Timing to Yes.

查看更多
我想做一个坏孩纸
3楼-- · 2019-01-04 18:25

Tools->Options->Projects and Solutions->Build and Run->

Set "MSBuild project build output verbosity" from "Minimal" to "Normal"

查看更多
在下西门庆
4楼-- · 2019-01-04 18:27

Menu ToolsOptionsProjects and SolutionsVC++ Project SettingsBuild Timing should work.

查看更多
三岁会撩人
5楼-- · 2019-01-04 18:33

Go to Tools → Options → Projects and Solutions → Build and Run → MSBuild project build output verbosity - set to "Normal" or "Detailed", and the build time will appear in the output window.

查看更多
Summer. ? 凉城
6楼-- · 2019-01-04 18:39

For Visual Studio 2012 you could use the Build Monitor extension.

查看更多
男人必须洒脱
7楼-- · 2019-01-04 18:39

Do a build first and see which project is appearing first in the build output (Ctrl + Home in the output window). Right click that project → Project PropertiesCompileBuild EventsPre-build. And echo ###########%date% %time%#############.

So every time you see build results (or during build) do Ctrl + Home in the output window. And somewhere in that area the time and date stares at your face!

Oh and you might end up adding these details to many projects as the build order can change :)


I found a better solution! ###

ToolsOptionsProjects & SolutionsBuild and RunMSBuild project build output verbosity = Normal (or above Minimal). This adds the time in the beginning/top of output window. Ctrl + Home in the output window should do.

If we want to see how much time each projects take then Projects & SolutionsVC++ Project SettingsBuild Timing = yes. It is applicable to all projects; "VC++" is misleading.

查看更多
登录 后发表回答