Welcome to mirror list, hosted at ThFree Co, Russian Federation.

github.com/dotnet/runtime.git - Unnamed repository; edit this file 'description' to name the repository.
summaryrefslogtreecommitdiff
diff options
context:
space:
mode:
authorViktor Hofer <viktor.hofer@microsoft.com>2021-05-26 13:09:00 +0300
committerGitHub <noreply@github.com>2021-05-26 13:09:00 +0300
commit293d47286161827ecc0d6e96f9eb7b82dafe8307 (patch)
tree088462587506f45888b649e53a0d0ee715143ae1
parentf584c7401a24781b4c8e8e2a8097b85462ee4941 (diff)
Generate targets files that throws for unsupported netstandard applicable tfms (#53244)
* Generate targets files that throw for unsupported NS tfm For S.D.Common, S.Speech and S.Sec.Crypto.Pkcs we manually added a targets file to mark the .NETStandard asset as not applicable. This was done to allow defining a minimum supported .NETCoreApp version, even though a compatible .NETStandard asset is available. This commit automatically generates that targets file based on items.
-rw-r--r--Directory.Build.props1
-rw-r--r--Directory.Build.targets36
-rw-r--r--eng/_._ (renamed from src/libraries/Microsoft.NETCore.Platforms/src/_._)0
-rw-r--r--src/libraries/Microsoft.NETCore.Platforms/src/Microsoft.NETCore.Platforms.csproj2
-rw-r--r--src/libraries/System.Drawing.Common/pkg/System.Drawing.Common.pkgproj5
-rw-r--r--src/libraries/System.Drawing.Common/pkg/buildTransitive/System.Drawing.Common.targets6
-rw-r--r--src/libraries/System.Security.Cryptography.Pkcs/pkg/System.Security.Cryptography.Pkcs.pkgproj5
-rw-r--r--src/libraries/System.Security.Cryptography.Pkcs/pkg/buildTransitive/System.Security.Cryptography.Pkcs.targets6
-rw-r--r--src/libraries/System.Speech/pkg/System.Speech.pkgproj5
-rw-r--r--src/libraries/System.Speech/pkg/buildTransitive/System.Speech.targets7
10 files changed, 41 insertions, 32 deletions
diff --git a/Directory.Build.props b/Directory.Build.props
index 0f0a130f6ae..c0adfc01c64 100644
--- a/Directory.Build.props
+++ b/Directory.Build.props
@@ -258,6 +258,7 @@
<GeneratePackage Condition="(('$(PreReleaseVersionLabel)' == 'servicing' or
'$(GitHubRepositoryName)' == 'runtimelab') and
'$(MSBuildProjectExtension)' != '.sfxproj')">false</GeneratePackage>
+ <PlaceholderFile>$(RepositoryEngineeringDir)_._</PlaceholderFile>
</PropertyGroup>
<!-- Language configuration -->
diff --git a/Directory.Build.targets b/Directory.Build.targets
index e6457e6111c..0460647e6de 100644
--- a/Directory.Build.targets
+++ b/Directory.Build.targets
@@ -54,6 +54,7 @@
<PackageDescription Condition="'$(PackageDescription)' == '' and '$(UseRuntimePackageDisclaimer)' == 'true'">$(RuntimePackageDisclaimer)</PackageDescription>
<!-- Keep in sync as required by the Packaging SDK in Arcade. -->
<Description>$(PackageDescription)</Description>
+ <BeforePack>$(BeforePack);AddNETStandardCompatErrorFileForPackaging</BeforePack>
</PropertyGroup>
<!-- Remove when https://github.com/NuGet/Home/issues/10405 is implemented and consumed. -->
@@ -70,4 +71,39 @@
<PackDependsOn />
</PropertyGroup>
</Target>
+
+ <!-- Add targets file that marks a .NETStandard applicable tfm as unsupported. -->
+ <Target Name="AddNETStandardCompatErrorFileForPackaging"
+ Condition="'@(NETStandardCompatError)' != ''"
+ Inputs="%(NETStandardCompatError.Identity)"
+ Outputs="unused"
+ BeforeTargets="GetFiles">
+ <PropertyGroup>
+ <_NETStandardCompatErrorFilePath>$(BaseIntermediateOutputPath)netstandardcompaterrors\%(NETStandardCompatError.Identity)\$(PackageId).targets</_NETStandardCompatErrorFilePath>
+ <_NETStandardCompatErrorFileTarget>NETStandardCompatError_$(PackageId.Replace('.', '_'))_$([System.String]::new('%(NETStandardCompatError.Supported)').Replace('.', '_'))</_NETStandardCompatErrorFileTarget>
+ <_NETStandardCompatErrorFileContent>
+<![CDATA[<Project InitialTargets="$(_NETStandardCompatErrorFileTarget)">
+ <Target Name="$(_NETStandardCompatErrorFileTarget)"
+ Condition="'%24(SuppressTfmSupportBuildWarnings)' == ''">
+ <Error Text="$(PackageId) doesn't support %24(TargetFramework). Consider updating your TargetFramework to %(NETStandardCompatError.Supported) or later." />
+ </Target>
+</Project>]]>
+ </_NETStandardCompatErrorFileContent>
+ </PropertyGroup>
+
+ <WriteLinesToFile File="$(_NETStandardCompatErrorFilePath)"
+ Lines="$(_NETStandardCompatErrorFileContent)"
+ Overwrite="true"
+ WriteOnlyWhenDifferent="true" />
+
+ <ItemGroup>
+ <None Include="$(_NETStandardCompatErrorFilePath)"
+ PackagePath="buildTransitive\%(NETStandardCompatError.Identity)"
+ Pack="true" />
+ <None Include="$(PlaceholderFile)"
+ PackagePath="buildTransitive\%(NETStandardCompatError.Supported)"
+ Pack="true" />
+ <FileWrites Include="$(_NETStandardCompatErrorFilePath)" />
+ </ItemGroup>
+ </Target>
</Project>
diff --git a/src/libraries/Microsoft.NETCore.Platforms/src/_._ b/eng/_._
index e69de29bb2d..e69de29bb2d 100644
--- a/src/libraries/Microsoft.NETCore.Platforms/src/_._
+++ b/eng/_._
diff --git a/src/libraries/Microsoft.NETCore.Platforms/src/Microsoft.NETCore.Platforms.csproj b/src/libraries/Microsoft.NETCore.Platforms/src/Microsoft.NETCore.Platforms.csproj
index 926335be52e..3259946e31e 100644
--- a/src/libraries/Microsoft.NETCore.Platforms/src/Microsoft.NETCore.Platforms.csproj
+++ b/src/libraries/Microsoft.NETCore.Platforms/src/Microsoft.NETCore.Platforms.csproj
@@ -38,7 +38,7 @@
<ItemGroup>
<Content Condition="'$(AdditionalRuntimeIdentifiers)' == ''" Include="runtime.json" PackagePath="/" />
<Content Condition="'$(AdditionalRuntimeIdentifiers)' != ''" Include="$(IntermediateOutputPath)runtime.json" PackagePath="/" />
- <Content Include="_._" PackagePath="lib/netstandard1.0" />
+ <Content Include="$(PlaceholderFile)" PackagePath="lib/netstandard1.0" />
</ItemGroup>
<ItemGroup>
diff --git a/src/libraries/System.Drawing.Common/pkg/System.Drawing.Common.pkgproj b/src/libraries/System.Drawing.Common/pkg/System.Drawing.Common.pkgproj
index 96aaf224ad1..d478641dc5e 100644
--- a/src/libraries/System.Drawing.Common/pkg/System.Drawing.Common.pkgproj
+++ b/src/libraries/System.Drawing.Common/pkg/System.Drawing.Common.pkgproj
@@ -6,10 +6,7 @@
</ProjectReference>
<ProjectReference Include="..\src\System.Drawing.Common.csproj" />
<InboxOnTargetFramework Include="$(AllXamarinFrameworks)" />
- <PackageFile Include="buildTransitive\System.Drawing.Common.targets"
- TargetPath="buildTransitive\netcoreapp2.0" />
- <File Include="$(PlaceHolderFile)"
- TargetPath="buildTransitive\netcoreapp3.0" />
+ <NETStandardCompatError Include="netcoreapp2.0" Supported="netcoreapp3.1" />
</ItemGroup>
<Import Project="$([MSBuild]::GetPathOfFileAbove(Directory.Build.targets))" />
</Project>
diff --git a/src/libraries/System.Drawing.Common/pkg/buildTransitive/System.Drawing.Common.targets b/src/libraries/System.Drawing.Common/pkg/buildTransitive/System.Drawing.Common.targets
deleted file mode 100644
index fba8a5498c0..00000000000
--- a/src/libraries/System.Drawing.Common/pkg/buildTransitive/System.Drawing.Common.targets
+++ /dev/null
@@ -1,6 +0,0 @@
-<Project InitialTargets="_ErrorForSystemDrawingCommonOnNetCoreApp2x">
- <Target Name="_ErrorForSystemDrawingCommonOnNetCoreApp2x"
- Condition="'$(SuppressTfmSupportBuildWarnings)' == ''">
- <Error Text="System.Drawing.Common doesn't support $(TargetFramework). Consider updating your TargetFramework to netcoreapp3.1 or later." />
- </Target>
-</Project>
diff --git a/src/libraries/System.Security.Cryptography.Pkcs/pkg/System.Security.Cryptography.Pkcs.pkgproj b/src/libraries/System.Security.Cryptography.Pkcs/pkg/System.Security.Cryptography.Pkcs.pkgproj
index 740607c0579..0fd0f8c5b4f 100644
--- a/src/libraries/System.Security.Cryptography.Pkcs/pkg/System.Security.Cryptography.Pkcs.pkgproj
+++ b/src/libraries/System.Security.Cryptography.Pkcs/pkg/System.Security.Cryptography.Pkcs.pkgproj
@@ -5,10 +5,7 @@
<SupportedFramework>net461;netcoreapp2.0;uap10.0.16299;$(AllXamarinFrameworks)</SupportedFramework>
</ProjectReference>
<ProjectReference Include="..\src\System.Security.Cryptography.Pkcs.csproj" />
- <PackageFile Include="buildTransitive\System.Security.Cryptography.Pkcs.targets"
- TargetPath="buildTransitive\netcoreapp2.0" />
- <File Include="$(PlaceholderFile)"
- TargetPath="buildTransitive\netcoreapp3.0" />
+ <NETStandardCompatError Include="netcoreapp2.0" Supported="netcoreapp3.1" />
<!-- Exclude TFMs that aren't supported by the package anymore from validation. -->
<ExcludeHarvestedSupportedFramework Include="netcoreapp1.0;netcoreapp1.1;netcore50;uap10.0;net46" />
</ItemGroup>
diff --git a/src/libraries/System.Security.Cryptography.Pkcs/pkg/buildTransitive/System.Security.Cryptography.Pkcs.targets b/src/libraries/System.Security.Cryptography.Pkcs/pkg/buildTransitive/System.Security.Cryptography.Pkcs.targets
deleted file mode 100644
index e293d8184ea..00000000000
--- a/src/libraries/System.Security.Cryptography.Pkcs/pkg/buildTransitive/System.Security.Cryptography.Pkcs.targets
+++ /dev/null
@@ -1,6 +0,0 @@
-<Project InitialTargets="_ErrorForSystemSecurityCryptographyPkcsOnNetCoreApp20">
- <Target Name="_ErrorForSystemSecurityCryptographyPkcsOnNetCoreApp20"
- Condition="'$(SuppressTfmSupportBuildWarnings)' == ''">
- <Error Text="System.Security.Cryptography.Pkcs doesn't support netcoreapp2.0. Consider updating your TargetFramework to netcoreapp3.1 or later." />
- </Target>
-</Project>
diff --git a/src/libraries/System.Speech/pkg/System.Speech.pkgproj b/src/libraries/System.Speech/pkg/System.Speech.pkgproj
index 96e4f979390..81e5c8bfd18 100644
--- a/src/libraries/System.Speech/pkg/System.Speech.pkgproj
+++ b/src/libraries/System.Speech/pkg/System.Speech.pkgproj
@@ -8,10 +8,7 @@
<InboxOnTargetFramework Include="net45">
<AsFrameworkReference>true</AsFrameworkReference>
</InboxOnTargetFramework>
- <PackageFile Include="buildTransitive\System.Speech.targets"
- TargetPath="buildTransitive\netcoreapp2.0" />
- <File Include="$(PlaceholderFile)"
- TargetPath="buildTransitive\netcoreapp2.1" />
+ <NETStandardCompatError Include="netcoreapp2.0" Supported="netcoreapp3.1" />
</ItemGroup>
<Import Project="$([MSBuild]::GetPathOfFileAbove(Directory.Build.targets))" />
</Project>
diff --git a/src/libraries/System.Speech/pkg/buildTransitive/System.Speech.targets b/src/libraries/System.Speech/pkg/buildTransitive/System.Speech.targets
deleted file mode 100644
index 94418a7f2df..00000000000
--- a/src/libraries/System.Speech/pkg/buildTransitive/System.Speech.targets
+++ /dev/null
@@ -1,7 +0,0 @@
-<Project InitialTargets="_ErrorForSystemSpeechOnNetCoreApp20">
- <Target Name="_ErrorForSystemSpeechOnNetCoreApp20"
- Condition="'$(SuppressTfmSupportBuildWarnings)' == ''">
- <Error Text="System.Speech doesn't support netcoreapp2.0. Consider updating your TargetFramework to netcoreapp2.1 or later."
- Code="SYSLIB9000" />
- </Target>
-</Project>