Build Related Improvement in VS2010 SP1

Visual CPP Team

Hi, my name is Li Shao. I am a Software Design Engineer in Test in C++ team. In VS2010, C++ has accomplished the migration of VCBuild to MSBuild based project and Build system. We have received very warm acceptance and overall customer satisfaction is very good. You can take a look of a few of my previous blogs (Native MultiTargeting, Conversion, Custom Build Rules) for some features and issues related to migration to MSBuild based build system for C++. VS2010 VS2010 SP1 release is around the corner. I would like to take this opportunity to let you know a few improvements that we have made in this area based on your feedback.

 

Managed Incremental Build

When referencing managed assemblies, a full rebuild is only needed when there are significant changes in the referenced assemblies. Significant changes include things like assembly version change, function signature, interface changes, etc. This functionality will greatly reduce the build time for managed or managed/native interop applications, where managed or managed assemblies are referenced.

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.

Enable Managed Incremental Build

 

Custom Dependency File List for Incremental Build

One of the customer reported issues is that for VS2010 disregards the //{{NO_DEPENDENCIES}} line in the resource.h of MFC applications. When there is a resource.h change either manually or by adding a resource ID using the resource editor, all the files that include resource.h get rebuilt. This has a negative performance impact since resource.h can be included by many files. It is also a behavior change from VS2008.

To fix the problem, in VS2010 SP1, we have implemented a fix so that you can specify the list of header files that they would like to skip when doing incremental build. The property introduced is “NoDependencies”. There are four ways that you can take advantage of this feature:

1. Set as an environment variable

You can use this approach if the dependencies to resource header files are common across all your projects. For example: set NoDependencies=resource.h;resource2.h.

You can set this in the environment that you launch Devenv or set this in your build environment

2. Set through property sheet

You can create a property sheet and set General -> No Dependencies File List to the list of files that you would like to exclude from dependency check.

No Dependencies File List

3. Set as a global property for your project

You can set the property as the following to the “Global” property of the project file:

  1. <PropertyGroup Label=Globals>
  2. <ProjectGuid>{3C2EE7D3-A2C9-40A5-91F0-3F988C8D5DF5}</ProjectGuid>
  3. <Keyword>AtlProj</Keyword>
  4. <NoDependencies> resource.h;resource2.h</NoDependencies>
  5. </PropertyGroup>

4. Set as a file level property

  1. <ClInclude Include=resource.h>
  2. <NoDependency>true</NoDependency>
  3. </ClInclude>

Note that this feature only works if you would like to skip certain headers from incremental building. It does not work for files other than header files.

 

Signing of Managed Assemblies

In VS2010, there was a bug that signing of the managed assemblies cannot be accomplished when Linker -> Advanced -> Delay Sign is set to “Yes”. We have previously recommended a workaround to address this issue. In general, you would need to use post build steps to sign the assembly. This is a regression in terms of functionality from VS2008 behavior. In VS2010 SP1, we have attempted to fix the problem. However, there were still some issues with the fix. You can take a look of this blog posted by my colleague Amit Mohindra on how to fix the problem. Essentially, you need to manually modify Microsoft.Cpp.Win32.targets. You can also take a look of this readme (http://go.microsoft.com/fwlink/?LinkId=210711 – section 2.4.1.2) if you have application converted with VS2010 prior to SP1 RTM.

 

These are the major changes we have made in SP1 regarding C++ build scenarios. Please let me know if you think there are issues we should have fixed. We will try to address them in future releases.

0 comments

Discussion is closed.

Feedback usabilla icon