Skip to content

Commit 36a8c7f

Browse files
committed
Avoid x-targeting perf impact on vcxproj
Targeted mitigation for dotnet#1276. VC++ noticed a dramatic regression in solution-load performance related to the time cost of ResolveProjectReferences. That affects all projects, but we can safely assume that a .vcxproj is NOT using cross-targeting, while it's impossible to detect from the outside whether a .csproj is. This commit avoids the regression for C++ projects by just not calling the MSBuild task again for .vcxproj references.
1 parent 2964bfe commit 36a8c7f

File tree

1 file changed

+7
-2
lines changed

1 file changed

+7
-2
lines changed

src/XMakeTasks/Microsoft.Common.CurrentVersion.targets

Lines changed: 7 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -1504,14 +1504,19 @@ Copyright (C) Microsoft Corporation. All rights reserved.
15041504
15051505
======================================================================================
15061506
-->
1507-
<Target Name="_GetProjectReferenceTargetFrameworkProperties" Outputs="%(_MSBuildProjectReferenceExistent.Identity)">
1507+
<Target Name="_GetProjectReferenceTargetFrameworkProperties"
1508+
Outputs="%(_MSBuildProjectReferenceExistent.Identity)">
1509+
<!-- As a mitigation for https://github.com/Microsoft/msbuild/issues/1276
1510+
.vcxproj is treated specially to avoid the cost of double-evaluating
1511+
for easily-identifiable-as-not-cross-targeting C++ projects. -->
15081512
<MSBuild
15091513
Projects="%(_MSBuildProjectReferenceExistent.Identity)"
15101514
Targets="GetTargetFrameworkProperties"
15111515
BuildInParallel="$(BuildInParallel)"
15121516
Properties="%(_MSBuildProjectReferenceExistent.SetConfiguration); %(_MSBuildProjectReferenceExistent.SetPlatform); ReferringTargetFramework=$(TargetFrameworkMoniker)"
15131517
ContinueOnError="!$(BuildingProject)"
1514-
RemoveProperties="%(_MSBuildProjectReferenceExistent.GlobalPropertiesToRemove);TargetFramework">
1518+
RemoveProperties="%(_MSBuildProjectReferenceExistent.GlobalPropertiesToRemove);TargetFramework"
1519+
Condition="'%(_MSBuildProjectReferenceExistent.Extension)' != '.vcxproj'">
15151520

15161521
<Output TaskParameter="TargetOutputs" PropertyName="_ProjectReferenceTargetFrameworkProperties" />
15171522
</MSBuild>

0 commit comments

Comments
 (0)