forked from NuGet/NuGet.Client
-
Notifications
You must be signed in to change notification settings - Fork 0
/
Copy pathNuGet.Build.Tasks.Pack.csproj
188 lines (167 loc) · 9.15 KB
/
NuGet.Build.Tasks.Pack.csproj
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
114
115
116
117
118
119
120
121
122
123
124
125
126
127
128
129
130
131
132
133
134
135
136
137
138
139
140
141
142
143
144
145
146
147
148
149
150
151
152
153
154
155
156
157
158
159
160
161
162
163
164
165
166
167
168
169
170
171
172
173
174
175
176
177
178
179
180
181
182
183
184
185
186
187
188
<Project>
<Import Project="$([MSBuild]::GetDirectoryNameOfFileAbove($(MSBuildThisFileDirectory), 'README.md'))\build\common.props" />
<Import Project="Sdk.props" Sdk="Microsoft.NET.Sdk" />
<PropertyGroup>
<TargetFrameworks>$(TargetFrameworksLibrary)</TargetFrameworks>
<NoWarn>$(NoWarn);CS1591</NoWarn>
<AssemblyName>NuGet.Build.Tasks.Pack</AssemblyName>
<RootNamespace>$(AssemblyName)</RootNamespace>
<Shipping>true</Shipping>
<PackProject>true</PackProject>
<AppendRuntimeIdentifierToOutputPath>false</AppendRuntimeIdentifierToOutputPath>
<RuntimeIdentifier>win10-x64</RuntimeIdentifier>
<PreserveCompilationContext>true</PreserveCompilationContext>
<XPLATProject>true</XPLATProject>
<IncludeBuildOutput>false</IncludeBuildOutput>
<TargetsForTfmSpecificContentInPackage>$(TargetsForTfmSpecificContentInPackage);CreatePackNupkg</TargetsForTfmSpecificContentInPackage>
<SuppressDependenciesWhenPacking>true</SuppressDependenciesWhenPacking>
<DevelopmentDependency>true</DevelopmentDependency>
<Description>NuGet tasks for MSBuild and dotnet pack.</Description>
<NoWarn>$(NoWarn);NU5100</NoWarn>
<DepsFileGenerationMode>old</DepsFileGenerationMode>
</PropertyGroup>
<ItemGroup>
<Compile Include="..\NuGet.Build.Tasks\Common\MSBuildLogger.cs" />
<Compile Include="..\NuGet.Build.Tasks\GetProjectTargetFrameworksTask.cs" />
<Content Include="NuGet.Build.Tasks.Pack.targets" Pack="true" PackagePath="build;buildCrossTargeting">
<CopyToOutputDirectory>PreserveNewest</CopyToOutputDirectory>
</Content>
</ItemGroup>
<ItemGroup>
<ProjectReference Include="..\NuGet.Commands\NuGet.Commands.csproj" />
</ItemGroup>
<ItemGroup Condition=" '$(TargetFramework)' == '$(NETFXTargetFramework)' ">
<Reference Include="Microsoft.Build.Utilities.v4.0" Pack="false" />
<Reference Include="Microsoft.Build.Framework" Pack="false" />
</ItemGroup>
<ItemGroup Condition=" '$(IsCore)' == 'true' ">
<PackageReference Include="Microsoft.Build.Framework" />
<PackageReference Include="Microsoft.Build.Tasks.Core" />
<PackageReference Include="Microsoft.Build.Utilities.Core" />
</ItemGroup>
<ItemGroup>
<Compile Update="Strings.Designer.cs">
<DesignTime>True</DesignTime>
<AutoGen>True</AutoGen>
<DependentUpon>Strings.resx</DependentUpon>
</Compile>
</ItemGroup>
<ItemGroup>
<EmbeddedResource Update="Strings.resx">
<Generator>ResXFileCodeGenerator</Generator>
<LastGenOutput>Strings.Designer.cs</LastGenOutput>
</EmbeddedResource>
</ItemGroup>
<Target Name="PublishAndMergePackNupkg" AfterTargets="AfterBuild" Condition="'$(TargetFramework)' != '' AND '$(IsXPlat)' != 'true' AND '$(IsBuildOnlyXPLATProjects)' != 'true' AND '$(BuildingInsideVisualStudio)' != 'true'">
<MSBuild Projects="$(MSBuildProjectFullPath)" Targets="Publish;ILMergeNuGetPack" />
</Target>
<Target Name="ILMergeNuGetPackResourcesPerCulture" DependsOnTargets="Publish">
<ItemGroup>
<_PackResourceDlls Include="$(OutputPath)**\$(AssemblyName).resources.dll" />
</ItemGroup>
<MSBuild Projects="$(MSBuildProjectFullPath)" Targets="ILMergeNuGetPackResources"
Properties="CurrentCulture=%(_PackResourceDlls.RecursiveDir);
BuildProjectReferences=false">
</MSBuild>
</Target>
<Target Name="GetILMergePlatformArg" DependsOnTargets="ResolveReferences">
<ItemGroup>
<ILMergeMscorlibReferencePath Include="@(ReferencePath)" Condition="'%(ReferencePath.Filename)' == 'mscorlib'" />
</ItemGroup>
<PropertyGroup>
<ILMergePlatformDir>@(IlmergeMscorlibReferencePath->'%(RootDir)%(Directory)')</ILMergePlatformDir>
<ILMergePlatformArg>/targetplatform:v4,"$(ILMergePlatformDir.TrimEnd('\/'))"</ILMergePlatformArg>
</PropertyGroup>
</Target>
<Target Name="ILMergeNuGetPack" DependsOnTargets="GetILMergePlatformArg" Condition="'$(TargetFramework)' != '' AND '$(IsBuildOnlyXPLATProjects)' != 'true' ">
<PropertyGroup>
<ILMergeResultDir>$(OutputPath)ilmerge</ILMergeResultDir>
</PropertyGroup>
<MakeDir Directories="$(ILMergeResultDir)" />
<ItemGroup>
<BuildArtifacts Include="$(OutputPath)*.dll" Exclude="$(OutputPath)*Pack.dll" />
</ItemGroup>
<PropertyGroup>
<PathToMergedNuGetPack>$(ILMergeResultDir)\NuGet.Build.Tasks.Pack.dll</PathToMergedNuGetPack>
<IlmergeCommand>$(ILMergeExePath) /out:$(PathToMergedNuGetPack) $(ILMergePlatformArg) /lib:$(OutputPath)$(RuntimeIdentifier)\publish /internalize /xmldocs /log:$(ILMergeResultDir)IlMergeLog.txt</IlmergeCommand>
<IlmergeCommand Condition="Exists($(MS_PFX_PATH))">$(IlmergeCommand) /delaysign /keyfile:$(MS_PFX_PATH)</IlmergeCommand>
<IlmergeCommand>$(IlmergeCommand) $(OutputPath)NuGet.Build.Tasks.Pack.dll @(BuildArtifacts, ' ')</IlmergeCommand>
</PropertyGroup>
<Exec Command="$(IlmergeCommand)" ContinueOnError="false" />
</Target>
<Target Name="ILMergeNuGetPackResources" DependsOnTargets="GetILMergePlatformArg" Condition="'$(TargetFramework)' != '' AND '$(CurrentCulture)' != ''">
<PropertyGroup>
<ILMergeResultDir>$(OutputPath)ilmerge\$(CurrentCulture)</ILMergeResultDir>
</PropertyGroup>
<MakeDir Directories="$(ILMergeResultDir)" />
<ItemGroup>
<ResourceArtifacts Include="$(OutputPath)$(CurrentCulture)NuGet*.resources.dll" Exclude="$(OutputPath)$(CurrentCulture)*Pack.resources.dll" />
</ItemGroup>
<PropertyGroup>
<PathToMergedNuGetPackResource>$(ILMergeResultDir)NuGet.Build.Tasks.Pack.resources.dll</PathToMergedNuGetPackResource>
<IlmergeCommand>$(ILMergeExePath) /out:$(PathToMergedNuGetPackResource) $(ILMergePlatformArg) /lib:$(OutputPath)$(RuntimeIdentifier)\publish /internalize /xmldocs /log:$(ILMergeResultDir)IlMergeLog.txt</IlmergeCommand>
<IlmergeCommand Condition="Exists($(MS_PFX_PATH))">$(IlmergeCommand) /delaysign /keyfile:$(MS_PFX_PATH)</IlmergeCommand>
<IlmergeCommand>$(IlmergeCommand) $(OutputPath)$(CurrentCulture)NuGet.Build.Tasks.Pack.resources.dll @(ResourceArtifacts, ' ')</IlmergeCommand>
</PropertyGroup>
<Exec Command="$(IlmergeCommand)" ContinueOnError="false" />
</Target>
<!--These targets help get all the DLLs that are packed in the nuspec to be sent for signing.-->
<Target Name="GetIlmergeBuildOutput" DependsOnTargets="ILMergeNuGetPackResourcesPerCulture;_GetDllsInOutputDirectory" Returns="@(DllsToSign)">
<ItemGroup>
<DllsToSign Include="@(DllsInOutputDir)" KeepDuplicates="false" />
</ItemGroup>
</Target>
<Target Name="_GetDllsInOutputDirectory" Returns="@(DllsInOutputDir)">
<ItemGroup>
<DllsInOutputDir Include="$(OutputPath)ilmerge\*.dll" KeepDuplicates="false">
<StrongName>MsSharedLib72</StrongName>
<Authenticode>Microsoft400</Authenticode>
</DllsInOutputDir>
<DllsInOutputDir Include="$(OutputPath)ilmerge\*.xml" KeepDuplicates="false">
<Authenticode>MicrosoftXmlSHA2</Authenticode>
</DllsInOutputDir>
</ItemGroup>
</Target>
<!--These targets help get all the DLLs that are packed in the nuspec to be sent for signing.-->
<Target Name="GetIlmergeSymbolOutput" Returns="@(SymbolsToIndex)">
<ItemGroup>
<SymbolsToIndex Include="$(OutputPath)ilmerge\*.pdb" KeepDuplicates="false" />
</ItemGroup>
</Target>
<Target Name="GetFinalBuildOutput" Returns="@(DllsToIndex)">
<ItemGroup>
<DllsToIndex Include="$(OutputPath)ilmerge\NuGet.Build.Tasks.Pack.dll"/>
</ItemGroup>
</Target>
<Target Name="CreatePackNupkg">
<PropertyGroup>
<!-- Build from source can't use ILMerge. -->
<ILMergeSubpath Condition="'$(IsBuildOnlyXPLATProjects)' != 'true'">ilmerge\</ILMergeSubpath>
</PropertyGroup>
<ItemGroup Condition="'$(TargetFramework)' == '$(NETFXTargetFramework)' AND '$(IsBuildOnlyXPLATProjects)' != 'true'">
<TfmSpecificPackageFile Include="$(OutputPath)\$(ILMergeSubpath)NuGet.Build.Tasks.Pack.dll">
<PackagePath>Desktop/</PackagePath>
</TfmSpecificPackageFile>
<TfmSpecificPackageFile Include="$(OutputPath)\$(ILMergeSubpath)**\NuGet*.resources.dll">
<PackagePath>Desktop/</PackagePath>
</TfmSpecificPackageFile>
</ItemGroup>
<ItemGroup Condition="'$(TargetFramework)' == '$(NetStandardVersion)'">
<TfmSpecificPackageFile Include="$(OutputPath)\$(ILMergeSubpath)NuGet.Build.Tasks.Pack.dll">
<PackagePath>CoreCLR/</PackagePath>
</TfmSpecificPackageFile>
<TfmSpecificPackageFile Include="$(OutputPath)\$(ILMergeSubpath)**\NuGet*.resources.dll">
<PackagePath>CoreCLR/</PackagePath>
</TfmSpecificPackageFile>
<TfmSpecificPackageFile Include="$(OutputPath)\$(ILMergeSubpath)**\*.dll" Condition="'$(IsBuildOnlyXPLATProjects)' == 'true'">
<PackagePath>CoreCLR/</PackagePath>
</TfmSpecificPackageFile>
</ItemGroup>
</Target>
<Import Project="$(BuildCommonDirectory)common.targets"/>
<Import Project="Sdk.targets" Sdk="Microsoft.NET.Sdk" />
<PropertyGroup>
<SignTargetsForRealSigning Condition="'$(IsSymbolsBuild)' != 'true'">GetIlmergeBuildOutput</SignTargetsForRealSigning>
<SymbolTargetsToGetPdbs>GetIlmergeSymbolOutput;GetFinalBuildOutput</SymbolTargetsToGetPdbs>
</PropertyGroup>
</Project>