diff options
author | Elinor Fung <elfung@microsoft.com> | 2021-06-11 20:04:20 +0300 |
---|---|---|
committer | Elinor Fung <elfung@microsoft.com> | 2021-06-11 20:04:20 +0300 |
commit | 6271751fcac9b1190ba66df27821695ac92c2292 (patch) | |
tree | f763bf2d5336b802fb7d91c4a96c7d405711a640 /Directory.Build.targets | |
parent | e1cab8073ec669569502751e95fe956d6b8e7668 (diff) | |
parent | 645dfe69fb25407de7a5484d7a03d3342b4e0279 (diff) |
Merge remote-tracking branch 'upstream/main' into HEAD
Diffstat (limited to 'Directory.Build.targets')
-rw-r--r-- | Directory.Build.targets | 36 |
1 files changed, 36 insertions, 0 deletions
diff --git a/Directory.Build.targets b/Directory.Build.targets index c46b686c543..3aa6ad169b1 100644 --- a/Directory.Build.targets +++ b/Directory.Build.targets @@ -55,6 +55,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. --> @@ -71,4 +72,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> |