Problem: VC++ 2010 SP1 project reference fails when .NET 4.5 installed

Applies to: Visual Studio Professional 2010Visual Studio Premium 2010Visual Studio Ultimate 2010


  • Project to project (P2P) references to native VC++ projects are shown in the UI as unresolved (on the “Framework and References” property page). This is indicated by a red exclamation point icon next to the reference name as well as a missing Full Path property.
  • Users that programmatically queue the references (via DTE) will get an empty result or exception.
  • During execution of unit test projects (pressing F5), you get the exception: Exception of type ‘System.Exception’ was thrown


There was a change in Microsoft.Common.targets between .NET 4.0 and .NET 4.5 that changes the behavior of project to project (P2P) references in Visual Studio 2010. This issue can be caused by any combination of Visual Studio 2010 SP1 and .NET 4.5.


Create a text file named "Microsoft.CppBuildEx.targets" that contains the following text:

WARNING: DO NOT MODIFY this file unless you are knowledgeable about MSBuild and have
created a backup copy. Incorrect changes to this file will make it
impossible to load or build your projects from the command-line or the IDE.
This file modifies the steps/targets required to build Visual C++ projects.
Copyright (C) Microsoft Corporation. All rights reserved.
<Project ToolsVersion="4.0" xmlns="">
<!-- Overrides existing "SetToGetNativeTargetPath" to set 'DesignTimeBuild_GetNativeTargetPath' flag for all C++ projects reference.
SetToGetNativeTargetPath is only called during design time build. -->
<Target Name="SetToGetNativeTargetPath" >
<AdditionalProperties Condition="'%(Extension)' == '.vcxproj'">DesignTimeBuild_GetNativeTargetPath=true</AdditionalProperties>
<!-- Overrides existing "GetTargetPath" to return TargetPath if the project is managed or
returns TargetPath if DesignTimeBuild_GetNativeTargetPath is true. -->
<Target Name="GetTargetPath" DependsOnTargets="_DetermineManagedStateFromCL" Returns="@(ManagedTargetPath)" >
<ManagedTargetPath Include="$(TargetPath)" Condition="'$(ManagedAssembly)' == 'true' or '$(DesignTimeBuild_GetNativeTargetPath)' == 'true'" />

Add the Microsoft.CppBuildEx.targets file to each of these folders (create the folders if needed):

32-bit (x86) Windows:

64-bit (x64) Windows: