From 5c3c690d6d34ae90094007efd677c7040aeba654 Mon Sep 17 00:00:00 2001 From: Anirudh Agnihotry Date: Thu, 5 Nov 2020 19:54:19 -0800 Subject: [PATCH] Use targetPlatformMoniker for net5.0 and newer tfms (#43965) * Use targetPlatformMoniker for net5.0 and newer tfms * disabling analyzer, update version to 0.0, and use new format. * update the targetFramework.sdk * removing supportedOS assembly level attribute * fix linker errors and addressing feedback * making _TargetFrameworkWithoutPlatform as private --- eng/BeforeTargetFrameworkInference.targets | 11 ++++++----- eng/resolveContract.targets | 6 +++--- eng/targetframeworksuffix.props | 12 ++++++++++++ eng/versioning.targets | 10 ++++++++++ global.json | 2 +- src/libraries/Directory.Build.props | 2 +- 6 files changed, 33 insertions(+), 10 deletions(-) diff --git a/eng/BeforeTargetFrameworkInference.targets b/eng/BeforeTargetFrameworkInference.targets index abef4c8..9360938 100644 --- a/eng/BeforeTargetFrameworkInference.targets +++ b/eng/BeforeTargetFrameworkInference.targets @@ -3,17 +3,18 @@ <_OriginalTargetFramework>$(TargetFramework) $(TargetFramework.SubString($([MSBuild]::Add($(TargetFramework.IndexOf('-')), 1)))) - $(TargetFramework.SubString(0, $(TargetFramework.IndexOf('-')))) + + $([System.Text.RegularExpressions.Regex]::Replace('$(TargetFramework)', '$(TargetFrameworkPattern)', '${1}')) - $([MSBuild]::NormalizeDirectory('$(BaseIntermediateOutputPath)', '$(TargetFramework)-$(TargetFrameworkSuffix)-$(Configuration)')) - $([MSBuild]::NormalizeDirectory('$(BaseIntermediateOutputPath)', '$(TargetFramework)-$(Configuration)')) + $([MSBuild]::NormalizeDirectory('$(BaseIntermediateOutputPath)', '$(TargetFramework)-$(Configuration)')) + $([MSBuild]::NormalizeDirectory('$(BaseIntermediateOutputPath)', '$(TargetFramework)-$(TargetFrameworkSuffix)-$(Configuration)')) - $([MSBuild]::NormalizeDirectory('$(BaseOutputPath)', '$(TargetFramework)-$(TargetFrameworkSuffix)-$(Configuration)')) - $([MSBuild]::NormalizeDirectory('$(BaseOutputPath)', '$(TargetFramework)-$(Configuration)')) + $([MSBuild]::NormalizeDirectory('$(BaseOutputPath)', '$(TargetFramework)-$(Configuration)')) + $([MSBuild]::NormalizeDirectory('$(BaseOutputPath)', '$(TargetFramework)-$(TargetFrameworkSuffix)-$(Configuration)')) diff --git a/eng/resolveContract.targets b/eng/resolveContract.targets index 6f4bb0e..0608475 100644 --- a/eng/resolveContract.targets +++ b/eng/resolveContract.targets @@ -12,8 +12,8 @@ $(NetCoreAppCurrentRefPath)$(TargetFileName) - $([MSBuild]::NormalizePath('$(BaseOutputPath)', 'ref', '$(TargetFramework)-$(Configuration)', '$(TargetFileName)')) - + <_TargetFrameworkWithoutPlatform>$([System.Text.RegularExpressions.Regex]::Replace('$(TargetFramework)', '(-[^;]+)', '')) + $([MSBuild]::NormalizePath('$(BaseOutputPath)', 'ref', '$(_TargetFrameworkWithoutPlatform)-$(Configuration)', '$(TargetFileName)')) false @@ -59,4 +59,4 @@ ReferenceAssembly="" /> - \ No newline at end of file + diff --git a/eng/targetframeworksuffix.props b/eng/targetframeworksuffix.props index 80443a1..2525ce9 100644 --- a/eng/targetframeworksuffix.props +++ b/eng/targetframeworksuffix.props @@ -1,4 +1,16 @@ + + + true + true + + + + $(TargetFrameworkSuffix) + 0.0 + $(TargetFrameworkSuffix),Version=$(TargetPlatformVersion) + + diff --git a/eng/versioning.targets b/eng/versioning.targets index 6178974..3177b48 100644 --- a/eng/versioning.targets +++ b/eng/versioning.targets @@ -155,4 +155,14 @@ WriteOnlyWhenDifferent="true" /> + + + + + + + + + diff --git a/global.json b/global.json index 712486f..e74fc18 100644 --- a/global.json +++ b/global.json @@ -12,7 +12,7 @@ "python3": "3.7.1" }, "msbuild-sdks": { - "Microsoft.DotNet.Build.Tasks.TargetFramework.Sdk": "6.0.0-beta.20529.1", + "Microsoft.DotNet.Build.Tasks.TargetFramework.Sdk": "6.0.0-beta.20554.1", "Microsoft.DotNet.Arcade.Sdk": "6.0.0-beta.20529.1", "Microsoft.DotNet.Build.Tasks.SharedFramework.Sdk": "6.0.0-beta.20529.1", "Microsoft.DotNet.Helix.Sdk": "6.0.0-beta.20529.1", diff --git a/src/libraries/Directory.Build.props b/src/libraries/Directory.Build.props index 9e05e68..b48551a 100644 --- a/src/libraries/Directory.Build.props +++ b/src/libraries/Directory.Build.props @@ -39,7 +39,7 @@ Debug - $(TargetFramework) + $([System.Text.RegularExpressions.Regex]::Replace('$(TargetFramework)', '(-[^;]+)', '')) net45;net451;net452;net46;net461;net462;net47;net471;net472 $(AdditionalBuildTargetFrameworks);netstandard2.0 -- 2.7.4