Incremental build with MSBuild.exe

I am creating a Visual Studio 2010 solution through Python with a subprocess call. When called directly from the command line, devenv.com takes ~ 15 seconds. But when called from Python, this is a jump of up to ~ 1.5 minutes.

Naturally, I hope to remove this dead time from our assembly. So I decided to test MSBuild.exe (from .NET 4). It looks like MSBuild.exe is starting instantly. But ... he seems to be doing a complete build every time, not incremental.

The command I use

"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 incremental builds. But I saw messages on the Internet indicating that msbuild might not be able to support an incremental build like this.

Is it possible? If so, what am I doing wrong?

Update:

I read it a little more. Based upon

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

I seem to need the input and output properties set in my .vcxproj files. Checking my files, they are really missing.

When will they be generated? Most of my .vcxproj files were converted from Visual Studio 2008. But I also created a new project that lacks input and output properties.

Does VS2010 create projects with these properties?

Update: from the moment of updating to VS 2013. Now msbuild supports incremental builds. Never got into the core of VS 2010 issue.

+5
source share
1 answer

I think the fact that incremental builds are not supported is a false expression from official sources, Managed Incremental Build of this function was included in VS2010 SP1

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

Other solutions I found on the Internet

  • Projects should grow gradually (just make sure you do Build instead of Rebuild). The best way to check if incremental construction work is to run the assembly from the command line. The second time you create it should take almost full time.

    If everything is still restored, you may have changed your projects in some way, which will ruin the build order. By looking at build logs (via the / v option), you can help what happens.

  • Another reason that can cause problems with incremental builds is the GenerateResource.TrackFileAccess Property . This API supports the .NET Framework and is not intended to be used directly from your code. Gets or sets a switch that indicates whether to track file access patterns.
+2
source

Source: https://habr.com/ru/post/1206274/


All Articles