forked from dotnet/runtime
-
Notifications
You must be signed in to change notification settings - Fork 0
/
packaging.targets
41 lines (38 loc) · 2.34 KB
/
packaging.targets
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
<Project>
<!-- There are some packages where we require only one ref for a specific framework to be present. In order to avoid problems with this package when targetting
dektop with RAR we will make sure there are no exclude=compile references in the package.
For more info, please check issues:
- https://github.com/dotnet/runtime/issues/27470 -> Why reference assets were removed from the package
- https://github.com/dotnet/aspnetcore/issues/11206 -> Why ASP.NET required a ref to be added back for netcoreapp
- https://github.com/dotnet/runtime/issues/29966 -> Issue tracking to work of readding a ref to netcoreapp -->
<Target Name="RemoveExcludeCompileFromPackageDependencies" Condition="'$(RemoveExcludeCompileFromPackageDependencies)' == 'true'" DependsOnTargets="GetPackageDependencies" BeforeTargets="ValidateExcludeCompileDesktop">
<ItemGroup>
<Dependency>
<Exclude></Exclude>
</Dependency>
</ItemGroup>
</Target>
<Target Name="ValidateExcludeCompileDesktop"
AfterTargets="GetPackageDependencies"
Inputs="%(Dependency.Identity);%(Dependency.TargetFramework)"
Outputs="unused"
Condition="'$(SkipValidatePackage)' != 'true'">
<PropertyGroup>
<_excludeCompile Condition="@(Dependency->WithMetadataValue('Exclude', 'Compile')->Count()) == @(Dependency->Count())">true</_excludeCompile>
</PropertyGroup>
<Error Text="Cannot have Exclude=Compile dependencies when targeting a desktop TFM. @(Dependency). You can exclude the reference asset in the package by setting the ExcludeReferenceAssets property to true in your project."
Condition="$([System.String]::Copy('%(Dependency.TargetFramework)').StartsWith('net4')) and
'$(_excludeCompile)' == 'true' and
'%(Dependency.Identity)' != '_._'" />
</Target>
<PropertyGroup>
<PkgProjPath>$(MSBuildProjectDirectory)\..\pkg\$(MSBuildProjectName).pkgproj</PkgProjPath>
<!-- Point to our custom pack target which builds the pkgproj instead. -->
<PackDependsOn Condition="'$(IsSourceProject)' == 'true' and
Exists('$(PkgProjPath)')">_BuildPkgProj</PackDependsOn>
</PropertyGroup>
<Target Name="_BuildPkgProj">
<MSBuild Projects="$(PkgProjPath)"
Targets="Build" />
</Target>
</Project>