diff options
author | Anirudh Agnihotry <anirudhagnihotry098@gmail.com> | 2020-11-06 06:54:19 +0300 |
---|---|---|
committer | GitHub <noreply@github.com> | 2020-11-06 06:54:19 +0300 |
commit | 5c3c690d6d34ae90094007efd677c7040aeba654 (patch) | |
tree | c481ddc60b3538d8e6c54b82b6ec0e56afff0514 /eng | |
parent | 5aaf0c14c236a771e0460c963b5353300c029dd1 (diff) |
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
Diffstat (limited to 'eng')
-rw-r--r-- | eng/BeforeTargetFrameworkInference.targets | 11 | ||||
-rw-r--r-- | eng/resolveContract.targets | 6 | ||||
-rw-r--r-- | eng/targetframeworksuffix.props | 12 | ||||
-rw-r--r-- | eng/versioning.targets | 10 |
4 files changed, 31 insertions, 8 deletions
diff --git a/eng/BeforeTargetFrameworkInference.targets b/eng/BeforeTargetFrameworkInference.targets index abef4c8981a..93609381fb4 100644 --- a/eng/BeforeTargetFrameworkInference.targets +++ b/eng/BeforeTargetFrameworkInference.targets @@ -3,17 +3,18 @@ <PropertyGroup Condition="$(TargetFramework.Contains('-'))"> <_OriginalTargetFramework>$(TargetFramework)</_OriginalTargetFramework> <TargetFrameworkSuffix>$(TargetFramework.SubString($([MSBuild]::Add($(TargetFramework.IndexOf('-')), 1))))</TargetFrameworkSuffix> - <TargetFramework>$(TargetFramework.SubString(0, $(TargetFramework.IndexOf('-'))))</TargetFramework> + <!-- Strip away the TargetPlatform during the build for frameworks older than net5.0 because the assets file does not know about the TargetPlatform --> + <TargetFramework>$([System.Text.RegularExpressions.Regex]::Replace('$(TargetFramework)', '$(TargetFrameworkPattern)', '${1}'))</TargetFramework> </PropertyGroup> <Import Project="$(MSBuildThisDirectory)targetframeworksuffix.props" Condition="'$(DesignTimeBuild)' == 'true'" /> <PropertyGroup> - <IntermediateOutputPath>$([MSBuild]::NormalizeDirectory('$(BaseIntermediateOutputPath)', '$(TargetFramework)-$(TargetFrameworkSuffix)-$(Configuration)'))</IntermediateOutputPath> - <IntermediateOutputPath Condition="'$(TargetFrameworkSuffix)' == ''">$([MSBuild]::NormalizeDirectory('$(BaseIntermediateOutputPath)', '$(TargetFramework)-$(Configuration)'))</IntermediateOutputPath> + <IntermediateOutputPath>$([MSBuild]::NormalizeDirectory('$(BaseIntermediateOutputPath)', '$(TargetFramework)-$(Configuration)'))</IntermediateOutputPath> + <IntermediateOutputPath Condition="'$(TargetFrameworkSuffix)' != '' and !$(TargetFramework.Contains('-'))">$([MSBuild]::NormalizeDirectory('$(BaseIntermediateOutputPath)', '$(TargetFramework)-$(TargetFrameworkSuffix)-$(Configuration)'))</IntermediateOutputPath> <!-- setting the output paths --> - <OutputPath>$([MSBuild]::NormalizeDirectory('$(BaseOutputPath)', '$(TargetFramework)-$(TargetFrameworkSuffix)-$(Configuration)'))</OutputPath> - <OutputPath Condition="'$(TargetFrameworkSuffix)' == ''">$([MSBuild]::NormalizeDirectory('$(BaseOutputPath)', '$(TargetFramework)-$(Configuration)'))</OutputPath> + <OutputPath>$([MSBuild]::NormalizeDirectory('$(BaseOutputPath)', '$(TargetFramework)-$(Configuration)'))</OutputPath> + <OutputPath Condition="'$(TargetFrameworkSuffix)' != '' and !$(TargetFramework.Contains('-'))">$([MSBuild]::NormalizeDirectory('$(BaseOutputPath)', '$(TargetFramework)-$(TargetFrameworkSuffix)-$(Configuration)'))</OutputPath> </PropertyGroup> </Project> diff --git a/eng/resolveContract.targets b/eng/resolveContract.targets index 6f4bb0e253e..06084755937 100644 --- a/eng/resolveContract.targets +++ b/eng/resolveContract.targets @@ -12,8 +12,8 @@ <ContractAssemblyPath Condition="'$(ContractAssemblyPath)' == '' and '$(TargetFrameworkIdentifier)' == '.NETCoreApp' and $([MSBuild]::VersionGreaterThanOrEquals($(TargetFrameworkVersion), '$(NETCoreAppCurrentVersion)'))">$(NetCoreAppCurrentRefPath)$(TargetFileName)</ContractAssemblyPath> - <ContractAssemblyPath Condition="'$(ContractAssemblyPath)' == ''">$([MSBuild]::NormalizePath('$(BaseOutputPath)', 'ref', '$(TargetFramework)-$(Configuration)', '$(TargetFileName)'))</ContractAssemblyPath> - + <_TargetFrameworkWithoutPlatform>$([System.Text.RegularExpressions.Regex]::Replace('$(TargetFramework)', '(-[^;]+)', ''))</_TargetFrameworkWithoutPlatform> + <ContractAssemblyPath Condition="'$(ContractAssemblyPath)' == ''">$([MSBuild]::NormalizePath('$(BaseOutputPath)', 'ref', '$(_TargetFrameworkWithoutPlatform)-$(Configuration)', '$(TargetFileName)'))</ContractAssemblyPath> <!-- Disable API compat if the project doesn't have reference assembly --> <RunApiCompat Condition="'$(HasMatchingContract)' != 'true'">false</RunApiCompat> </PropertyGroup> @@ -59,4 +59,4 @@ ReferenceAssembly="" /> </ItemGroup> </Target> -</Project>
\ No newline at end of file +</Project> diff --git a/eng/targetframeworksuffix.props b/eng/targetframeworksuffix.props index 80443a16468..2525ce954a3 100644 --- a/eng/targetframeworksuffix.props +++ b/eng/targetframeworksuffix.props @@ -1,4 +1,16 @@ <Project> + + <PropertyGroup> + <TargetPlatformSupported>true</TargetPlatformSupported> + <TargetPlatformVersionSupported>true</TargetPlatformVersionSupported> + </PropertyGroup> + + <PropertyGroup Condition="'$(TargetFrameworkSuffix)' != '' and '$(TargetFrameworkSuffix)' != 'windows'"> + <TargetPlatformIdentifier>$(TargetFrameworkSuffix)</TargetPlatformIdentifier> + <TargetPlatformVersion>0.0</TargetPlatformVersion> + <TargetPlatformMoniker>$(TargetFrameworkSuffix),Version=$(TargetPlatformVersion)</TargetPlatformMoniker> + </PropertyGroup> + <Choose> <When Condition="'$(TargetFrameworkSuffix)' == 'windows'"> <PropertyGroup> diff --git a/eng/versioning.targets b/eng/versioning.targets index 61789747403..3177b48b0ba 100644 --- a/eng/versioning.targets +++ b/eng/versioning.targets @@ -155,4 +155,14 @@ WriteOnlyWhenDifferent="true" /> </Target> + + <!-- Removes specified assembly level attributes. https://github.com/dotnet/runtime/issues/44257--> + <Target Name="RemoveSupportedPlatformAssemblyLevelAttribute" + AfterTargets="GetAssemblyAttributes"> + <ItemGroup> + <AssemblyAttribute Remove="System.Runtime.Versioning.SupportedOSPlatformAttribute" /> + <AssemblyAttribute Remove="System.Runtime.Versioning.TargetPlatformAttribute" /> + </ItemGroup> + </Target> + </Project> |