Incremental Build with MSBuild.exe
Asked Answered
K

1

7

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.

Kismet answered 5/11, 2014 at 18:43 Comment(3)
Where have you seen information that MSBuild does not support incremental build? Could you post URL or pointers how to find it?Watereddown
This is the post I found. social.msdn.microsoft.com/Forums/vstudio/en-US/…. The point that made me think an incremental build was not supported was "Neither MsBuild as a system, nor MSBuild as a task provide a means to know the inputs and outputs regarding a .sln being built.". But I'm unclear how accurate this statement is. Hence this question.Kismet
@vel eight years have passed since I asked this question. I'm no longer proficient on C++ builds and would need a ramp up on it to assist you.Kismet
G
2

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.
Goofy answered 17/2, 2015 at 19:10 Comment(3)
Ahhhh.... that makes sense. I did not have Service Pack 1. What an unusual feature to leave out of the initial release.Kismet
@ShaneGannon agreed :) !Goofy
@Goofy could you please be so kind to assist me with little bit similar issue? Thanks a lot #76533483Mitchell

© 2022 - 2024 — McMap. All rights reserved.