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 /Directory.Build.targets
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.
Diffstat (limited to 'Directory.Build.targets')
-rw-r--r--Directory.Build.targets36
1 files changed, 36 insertions, 0 deletions
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>