forked from dotnet/arcade-services
-
Notifications
You must be signed in to change notification settings - Fork 0
/
Copy pathBuildTask.targets
85 lines (76 loc) · 4.13 KB
/
BuildTask.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
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
59
60
61
62
63
64
65
66
67
68
69
70
71
72
73
74
75
76
77
78
79
80
81
82
83
84
85
<Project>
<PropertyGroup>
<MSBuildAllProjects>$(MSBuildAllProjects);$(MSBuildThisFileFullPath)</MSBuildAllProjects>
</PropertyGroup>
<PropertyGroup>
<IncludeBuildOutput>false</IncludeBuildOutput>
<IsPackable>true</IsPackable>
<!-- Build Tasks should not include any dependencies -->
<SuppressDependenciesWhenPacking Condition="'$(SuppressDependenciesWhenPacking)' == ''">true</SuppressDependenciesWhenPacking>
</PropertyGroup>
<!--
Default to including all *.props and *.targets files
from the project directory into the NuGet package root
-->
<ItemGroup Condition="'$(EnableDefaultItems)' != 'false'">
<None Condition="'$(EnableDefaultNoneItems)' != 'false'"
Include="**/*.props;**/*.targets" Pack="true">
<PackagePath>%(RecursiveDir)%(Filename)%(Extension)</PackagePath>
</None>
</ItemGroup>
<ItemGroup>
<None Include="$(RepoRoot)LICENSE.txt" PackagePath="LICENSE.txt" Pack="true"/>
<None Include="$(RepoRoot)THIRD-PARTY-NOTICES.txt" PackagePath="THIRD-PARTY-NOTICES.txt" Pack="true"/>
</ItemGroup>
<ItemGroup>
<!--
Update all PackageReference and ProjectReference Items to have
PrivateAssets="All" and default Publish to true.
This removes the dependency nodes from the generated nuspec and
forces the publish output to contain the dlls.
-->
<PackageReference Update="@(PackageReference)">
<PrivateAssets>All</PrivateAssets>
<Publish Condition="'%(PackageReference.Publish)' == ''">true</Publish>
<ExcludeAssets Condition="'%(PackageReference.Publish)' == 'false'">runtime</ExcludeAssets>
</PackageReference>
<ProjectReference Update="@(ProjectReference)">
<PrivateAssets>All</PrivateAssets>
<Publish Condition="'%(ProjectReference.Publish)' == ''">true</Publish>
</ProjectReference>
<!--
Update all Reference items to have Pack="false"
This removes the frameworkDependency nodes from the generated nuspec
-->
<Reference Update="@(Reference)">
<Pack>false</Pack>
</Reference>
<!--
Do not include assemblies that MSBuild ships with in the package.
-->
<PackageReference Update="Microsoft.Build" PrivateAssets="All" Publish="false" ExcludeAssets="runtime" />
<PackageReference Update="Microsoft.Build.Framework" PrivateAssets="All" Publish="false" ExcludeAssets="runtime" />
<PackageReference Update="Microsoft.Build.Tasks.Core" PrivateAssets="All" Publish="false" ExcludeAssets="runtime" />
<PackageReference Update="Microsoft.Build.Utilities.Core" PrivateAssets="All" Publish="false" ExcludeAssets="runtime" />
<PackageReference Update="System.Collections.Immutable" PrivateAssets="All" Publish="false" ExcludeAssets="runtime" />
<PackageReference Update="System.IO.Compression" PrivateAssets="All" Publish="false" ExcludeAssets="runtime" />
<PackageReference Update="System.Runtime.InteropServices.RuntimeInformation" PrivateAssets="All" Publish="false" ExcludeAssets="runtime" />
<PackageReference Update="System.Threading.Tasks.Dataflow" PrivateAssets="All" Publish="false" ExcludeAssets="runtime" />
</ItemGroup>
<PropertyGroup>
<TargetsForTfmSpecificContentInPackage>$(TargetsForTfmSpecificContentInPackage);_AddBuildOutputToPackageCore;_AddBuildOutputToPackageDesktop</TargetsForTfmSpecificContentInPackage>
</PropertyGroup>
<Target Name="_AddBuildOutputToPackageCore" DependsOnTargets="Publish" Condition="'$(TargetFrameworkIdentifier)' == '.NETCoreApp'">
<ItemGroup>
<!-- Publish .NET Core assets and include them in the package under tools directory. -->
<TfmSpecificPackageFile Include="$(PublishDir)**"
PackagePath="tools/$(TargetFramework)/%(RecursiveDir)%(FileName)%(Extension)"/>
</ItemGroup>
</Target>
<Target Name="_AddBuildOutputToPackageDesktop" Condition="'$(TargetFrameworkIdentifier)' != '.NETCoreApp'">
<ItemGroup>
<!-- Include .NET Framework build outputs in the package under tools directory. -->
<TfmSpecificPackageFile Include="$(OutputPath)**" PackagePath="tools/$(TargetFramework)/%(RecursiveDir)%(FileName)%(Extension)"/>
</ItemGroup>
</Target>
</Project>