Logo Questions Linux Laravel Mysql Ubuntu Git Menu
 

Incremental Build with MSBuild.exe

I'm building a Visual Studio 2010 solution through Python with a call to subprocess. When called directly from the command line it takes devenv.com ~15 seconds to start. But when called from Python this jumps up to ~1.5 minutes.

Naturally I'm hoping to remove that dead time from our build. So I decided to test out MSBuild.exe (from .NET 4). It looks like MSBuild.exe runs instantly. But... it seems to do a full build every time and not an incremental.

The command I'm using is

"C:\Windows\Microsoft.NET\Framework\v4.0.30319\MSBuild.exe" "C:\path\to\my\project.sln" /target:build /maxcpucount:8 /property:Configuration=Release

It seems like this should support an incremental build. But I've seen posts online indicating that msbuild may not be able to support a incremental build like this.

Is this possible? If so what am I doing wrong?

Update:

I've read into this a bit more. Based on

http://msdn.microsoft.com/en-us/library/ms171483.aspx

and

http://www.digitallycreated.net/Blog/67/incremental-builds-in-msbuild-and-how-to-avoid-breaking-them

It seems like I need the Input and Output properties set in my .vcxproj files. Checking out my files these are indeed missing.

When would they be generated? Most my .vcxproj files were converted over from Visual Studio 2008. But I also generated a new project which is missing the Input and Output properties as well.

Does VS2010 not create projects with these properties?

Update: We've since upgrade to VS 2013. Now msbuild supports incremental builds. Never got to the bottom of the VS 2010 issue.

like image 915
Shane Gannon Avatar asked Nov 05 '14 18:11

Shane Gannon


People also ask

What is MSBuild EXE?

The Microsoft Build Engine is a platform for building applications. This engine, which is also known as MSBuild, provides an XML schema for a project file that controls how the build platform processes and builds software.

Can MSBuild build C++?

This walkthrough demonstrates how to use MSBuild in a command prompt to build a Visual Studio C++ project. You'll learn how to create an XML-based . vcxproj project file for a Visual C++ console application. After building the project, you'll learn how to customize the build process.


1 Answers

I think that fact that Incremental builds are not supported is a false Statement from according to official sources,Managed Incremental Build this feature and was included in VS2010 SP1

We first introduced the managed incremental build feature in VS2008. In VS2010, we were not able to re-implement the managed incremental build feature with the build system moving to MSBuild. We received strong customer requests for this feature. As a result, we re-implemented this feature and it is included in VS2010 SP1.

Other Solutions I found on Web

  • Projects should build incrementally already (just make sure that you do Build instead of Rebuild). The best way to check if incremental building works is to run the build from the command line. The second time you build it should take almost no time.

    If things are still getting rebuilt, then perhaps you've modified your projects in some way that's messing up with the build order. Looking at the build logs (via the /v option) can help you poinpoint what's going on.

  • Other reason which can cause problems with the incremental build is GenerateResource.TrackFileAccess PropertyThis API supports the .NET Framework infrastructure and is not intended to be used directly from your code. Gets or sets a switch that specifies whether we should be tracking file access patterns.
like image 183
Heisenberg Avatar answered Sep 18 '22 13:09

Heisenberg