From ffb798cefc009d26a01f4abb8655d0b54ffd0ccc Mon Sep 17 00:00:00 2001 From: Rainer Sigwald Date: Thu, 2 Feb 2017 15:14:23 -0800 Subject: [PATCH] Respect projects that say they only have one TFM Partially fixes dotnet/sdk#739. The first iteration of cross-targeting support code unconditionally queried each ProjectReference for the best TFM to build against, and then explicitly specified that TFM when building the reference. This caused a race condition when building a set of projects that had a single-TFM project and another project that had a reference to it. The entry point (probably .sln) build would build the referenced project with no TF specified, and then the referencing project would build it with an explicit TF specified. These two builds appeared different to the MSBuild engine (because they had different sets of global properties) and so were both executed, resulting in a race condition. The fix is in two parts: * Allow a project to report back through GetTargetFrameworkProperties that it only has one TF to build. * When a project reports that it has only one TF to build, issue its build request without specifying any TF. This commit is the latter. --- src/XMakeTasks/Microsoft.Common.CurrentVersion.targets | 4 ++++ 1 file changed, 4 insertions(+) diff --git a/src/XMakeTasks/Microsoft.Common.CurrentVersion.targets b/src/XMakeTasks/Microsoft.Common.CurrentVersion.targets index da772b00e8c..4a60364d40c 100644 --- a/src/XMakeTasks/Microsoft.Common.CurrentVersion.targets +++ b/src/XMakeTasks/Microsoft.Common.CurrentVersion.targets @@ -1530,6 +1530,10 @@ Copyright (C) Microsoft Corporation. All rights reserved. <_MSBuildProjectReferenceExistent Condition="'%(_MSBuildProjectReferenceExistent.Identity)' == '%(Identity)'"> $(_ProjectReferenceTargetFrameworkProperties) + + %(_MSBuildProjectReferenceExistent.UndefineProperties);TargetFramework;ProjectHasSingleTargetFramework + + %(_MSBuildProjectReferenceExistent.UndefineProperties);ProjectHasSingleTargetFramework