From 4a563163cd055d0f5e7d13ac94f9f47994012017 Mon Sep 17 00:00:00 2001 From: Nirmal Guru Date: Wed, 8 Dec 2021 09:10:57 +0530 Subject: [PATCH] Prefer "TargetFramework" when specified globally - Prefer "TargetFramework" over its plural counterpart when specified globally, like on the command-line and in the MSBuild task, Properties metadata. - This also adds a "GetGlobalPropertyValueTask" for getting global properties. --- .../Core/NuGet.Restore.targets | 34 ++++++++++++++++--- .../NuGet.Build.Sdk/Tasks/NuGet.Restore.tasks | 1 + 2 files changed, 31 insertions(+), 4 deletions(-) diff --git a/Sources/NuGet.Build.Sdk/Core/NuGet.Restore.targets b/Sources/NuGet.Build.Sdk/Core/NuGet.Restore.targets index 558e6d3..f51ddb4 100644 --- a/Sources/NuGet.Build.Sdk/Core/NuGet.Restore.targets +++ b/Sources/NuGet.Build.Sdk/Core/NuGet.Restore.targets @@ -597,18 +597,20 @@ ============================================================ --> <_RestoreProjectFramework/> + <_PreferredTargetFrameworks Condition="'$(_IsGlobalTargetFramework)' == 'true'">$(TargetFramework) + <_PreferredTargetFrameworks Condition="'$(_IsGlobalTargetFramework)' != 'true'">$(TargetFrameworks) - <_RestoreTargetFrameworkItems Include="$(TargetFrameworks.Split(';'))"/> + <_RestoreTargetFrameworkItems Include="$(TargetFrameworks.Split(';'))" Condition="'$(_IsGlobalTargetFramework)' != 'true'"/> + + <_RestoreTargetFrameworkItems Include="$(TargetFramework)" Condition="'$(_IsGlobalTargetFramework)' == 'true'"/> @@ -1376,6 +1381,27 @@ + + + + + + + + + + <_IsGlobalTargetFramework Condition="'$(_GlobalTargetFramework)' == '$(TargetFramework)'">true + + + +