forked from dotnet/source-build-reference-packages
-
Notifications
You must be signed in to change notification settings - Fork 0
/
Directory.Build.targets
113 lines (97 loc) · 4.58 KB
/
Directory.Build.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
86
87
88
89
90
91
92
93
94
95
96
97
98
99
100
101
102
103
104
105
106
107
108
109
110
111
112
113
<Project>
<Import Project="Sdk.targets" Sdk="Microsoft.DotNet.Arcade.Sdk" />
<PropertyGroup>
<TFMPackTempOutputDir>$([MSBuild]::NormalizeDirectory('$(BaseOutputPath)', 'pack'))</TFMPackTempOutputDir>
</PropertyGroup>
<!--
Disable Arcade util that populates PackTask properties. For these projects, the nuspec already
contains everything. It's generated when the package is initially deconstructed and tends to be
unique per package, so there's no benefit to this Arcade util.
-->
<Target Name="InitializeStandardNuspecProperties" />
<Target Name="GetProjectSrc">
<ItemGroup>
<!--
Files that may need the 'constraint' token fixed before they can be assembled. They were
decompiled with a 3.1 ildasm not compatible with 5.0 ilasm. In some cases the fix is not
necessary for a given IL filename in a certain TFM, but is necessary for a file with the
same name in a different TFM. The patch doesn't take a particularly long time, so prefer
keeping this list simple.
-->
<TargetingPackSrcRequiringConstraintPatch
Include="
$(MSBuildProjectDirectory)\**\Microsoft.AspNetCore.Components.il;
$(MSBuildProjectDirectory)\**\Microsoft.AspNetCore.Mvc.Cors.il;
$(MSBuildProjectDirectory)\**\Microsoft.AspNetCore.Routing.il;
$(MSBuildProjectDirectory)\**\netstandard.il;
$(MSBuildProjectDirectory)\**\presentationframework.*.il;
$(MSBuildProjectDirectory)\**\PresentationFramework.*.il;
$(MSBuildProjectDirectory)\**\PresentationFramework.il;
$(MSBuildProjectDirectory)\**\System.Activities.Presentation.il;
$(MSBuildProjectDirectory)\**\System.ComponentModel.Composition.il;
$(MSBuildProjectDirectory)\**\System.Data.Common.il;
$(MSBuildProjectDirectory)\**\System.Data.Entity.il;
$(MSBuildProjectDirectory)\**\System.Data.il;
$(MSBuildProjectDirectory)\**\System.Design.il;
$(MSBuildProjectDirectory)\**\System.Reflection.Metadata.il;
$(MSBuildProjectDirectory)\**\System.Web.il;
$(MSBuildProjectDirectory)\**\System.Xml.il;
$(MSBuildProjectDirectory)\**\System.XML.il;
$(MSBuildProjectDirectory)\**\WindowsFormsIntegration.il" />
<!-- Find all IL. Leave out IL that needs to be patched before being built. -->
<TargetingPackSrc
Include="$(MSBuildProjectDirectory)\**\*.il"
Exclude="@(TargetingPackSrcRequiringConstraintPatch)" />
<TargetingPackSrc
RelativeOutputAssemblyFile="%(RecursiveDir)%(Filename).dll" />
<PotentialCompileSrc Include="**\*.cs" />
<NuGetGeneratedMetadataFile Include="
.signature.p7s;
_rels\**;
[Content_Types].xml;
" />
<StructureFile
Include="**\*.*"
Exclude="
@(TargetingPackSrc);
@(TargetingPackSrcRequiringConstraintPatch);
@(PotentialCompileSrc);
**\*.csproj;
@(NuGetGeneratedMetadataFile);
"
Condition="'$(TextOnlyPackage)' != 'true'" />
<StructureFile
Include="**\*"
Exclude="$(MSBuildProjectFullPath)"
Condition="'$(TextOnlyPackage)' == 'true'"/>
<StaticAssetFile
Include="@(StructureFile)"
Destination="$(TFMPackTempOutputDir)%(RecursiveDir)%(Filename)%(Extension)" />
</ItemGroup>
</Target>
<Target Name="CopyStaticAssetsToOutput"
BeforeTargets="GenerateNuspec"
DependsOnTargets="GetProjectSrc">
<!-- Ensure TFMPackTempOutputDir defined, to avoid globbing entire machine... -->
<Error Condition="'$(TFMPackTempOutputDir)' == ''" Text="TFMPackTempOutputDir not defined" />
<Copy
SourceFiles="@(StaticAssetFile)"
DestinationFiles="@(StaticAssetFile -> '%(Destination)')" />
</Target>
<!--
Instead of using the nuspec specified by a static property, use one that we find dynamically. In
this case, the project file has already statically set the nuspec property to some other value,
which takes priority over Directory.Build.props, so we override it dynamically in this target.
This target is also a nice place to enforce that we do actually have a nuspec.
-->
<Target Name="SetManualPackTaskInputs"
BeforeTargets="_CalculateInputsOutputsForPack;GenerateNuspec">
<ItemGroup>
<NuspecFile Include="*.nuspec" />
</ItemGroup>
<Error Condition="@(NuspecFile->Count()) != 1" Text="Expected exactly one nuspec file." />
<PropertyGroup>
<NuspecFile>$(TFMPackTempOutputDir)@(NuspecFile)</NuspecFile>
</PropertyGroup>
</Target>
</Project>