Displaying build times in Visual Studio?

Viewed 88415

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?

13 Answers

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

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.

I have created an extension to measure the build times and present the order of events in a graph: Visual Studio Build Timer.

enter image description here

It is available on visual studio market place and works for VS2015, VS2017 and VS2019.

Apart from showing which projects take longer, the chart displays effectively dependencies between them, i.e. projects that need to wait for others, which helps figuring out what dependencies need to break to increase the parallelization of your build.

Since your question involves using DevEnv from the command line, I would also suggest using MSBuild (which can build .sln files without modification).

msbuild /fl /flp:Verbosity=diagnostic Your.sln

msbuild /? will show you other useful options for the filelogger.

Options -> Projects and Solutions -> VC++ Project Settings -> Build Timing

enter image description here

Related