Skip to content
This repository was archived by the owner on Jan 12, 2024. It is now read-only.

Commit 4713efe

Browse files
committed
Add compatibility with IsTool and GeneratePackageOnBuild from SDK Pack
Fixes NuGet/Home#5104
1 parent 4fca8bd commit 4713efe

3 files changed

Lines changed: 41 additions & 15 deletions

File tree

Lines changed: 19 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,19 @@
1+
<!--
2+
***********************************************************************************************
3+
Microsoft.NuGet.Build.Packaging.Compatibility.targets
4+
5+
WARNING: DO NOT MODIFY this file unless you are knowledgeable about MSBuild and have
6+
created a backup copy. Incorrect changes to this file will make it
7+
impossible to load or build your projects from the command-line or the IDE.
8+
9+
Copyright (c) .NET Foundation. All rights reserved.
10+
***********************************************************************************************
11+
-->
12+
<Project xmlns="http://schemas.microsoft.com/developer/msbuild/2003">
13+
14+
<PropertyGroup>
15+
<PackOnBuild Condition="'$(GeneratePackageOnBuild)' == 'true'">true</PackOnBuild>
16+
<PrimaryOutputPackageFileKind Condition="'$(IsTool)' == 'true'">tool</PrimaryOutputPackageFileKind>
17+
</PropertyGroup>
18+
19+
</Project>

src/Build/NuGet.Build.Packaging.Tasks/NuGet.Build.Packaging.Tasks.csproj

Lines changed: 19 additions & 14 deletions
Original file line numberDiff line numberDiff line change
@@ -8,25 +8,27 @@
88
<OutputType>Exe</OutputType>
99
<TargetExt>.dll</TargetExt>
1010
<StartupObject>NuGet.Build.Packaging.Program</StartupObject>
11+
<PackOnBuild Condition="'$(PackOnBuild)' == '' And '$(Configuration)' == 'Release'">true</PackOnBuild>
12+
<PackageOutputPath Condition="'$(PackageOutputPath)' == ''">..\..\..\out</PackageOutputPath>
1113
</PropertyGroup>
1214
<ItemGroup>
1315
<Reference Include="System" />
1416
<Reference Include="System.Core" />
1517
</ItemGroup>
16-
<ItemGroup>
17-
<PackageReference Include="Costura.Fody" Version="1.3.3" />
18-
<PackageReference Include="Fody" Version="1.29.4" />
19-
<PackageReference Include="GitInfo" Version="1.*" />
20-
<PackageReference Include="netfx-System.StringResources" Version="*" />
21-
<PackageReference Include="Microsoft.Build" Version="14.3.0" />
22-
<PackageReference Include="Microsoft.Build.Tasks.Core" Version="14.3.0" />
23-
<PackageReference Include="MSBuilder.ThisAssembly.Project" Version="0.3.3" />
24-
<PackageReference Include="Newtonsoft.Json" Version="6.0.8" />
25-
<PackageReference Include="NuGet.Client" Version="4.0.0" />
26-
<PackageReference Include="NuGet.Packaging" Version="4.0.0" />
27-
<PackageReference Include="NuGet.ProjectManagement" Version="4.0.0" />
28-
</ItemGroup>
29-
<ItemGroup>
18+
<ItemGroup>
19+
<PackageReference Include="Costura.Fody" Version="1.3.3" PrivateAssets="all" />
20+
<PackageReference Include="Fody" Version="1.29.4" PrivateAssets="all" />
21+
<PackageReference Include="GitInfo" Version="1.*" PrivateAssets="all" />
22+
<PackageReference Include="netfx-System.StringResources" Version="*" PrivateAssets="all" />
23+
<PackageReference Include="Microsoft.Build" Version="14.3.0" PrivateAssets="all" />
24+
<PackageReference Include="Microsoft.Build.Tasks.Core" Version="14.3.0" PrivateAssets="all" />
25+
<PackageReference Include="MSBuilder.ThisAssembly.Project" Version="0.3.3" PrivateAssets="all" />
26+
<PackageReference Include="Newtonsoft.Json" Version="6.0.8" PrivateAssets="all" />
27+
<PackageReference Include="NuGet.Client" Version="4.0.0" PrivateAssets="all" />
28+
<PackageReference Include="NuGet.Packaging" Version="4.0.0" PrivateAssets="all" />
29+
<PackageReference Include="NuGet.ProjectManagement" Version="4.0.0" PrivateAssets="all" />
30+
</ItemGroup>
31+
<ItemGroup>
3032
<Content Include="FodyWeavers.xml" />
3133
<Content Include="NuGet.Build.Packaging.props">
3234
<CopyToOutputDirectory>PreserveNewest</CopyToOutputDirectory>
@@ -47,6 +49,9 @@
4749
<CopyToOutputDirectory>PreserveNewest</CopyToOutputDirectory>
4850
<SubType>Designer</SubType>
4951
</Content>
52+
<Content Include="NuGet.Build.Packaging.Compatibility.targets">
53+
<CopyToOutputDirectory>PreserveNewest</CopyToOutputDirectory>
54+
</Content>
5055
<None Include="NuGet.Build.Packaging.Version.props">
5156
<CopyToOutputDirectory>PreserveNewest</CopyToOutputDirectory>
5257
</None>

src/Build/NuGet.Build.Packaging.Tasks/NuGet.Build.Packaging.targets

Lines changed: 3 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -19,6 +19,8 @@ Copyright (c) .NET Foundation. All rights reserved.
1919
<UsingTask TaskName="NuGet.Build.Packaging.Tasks.GetApiIntersectTargetPaths" AssemblyFile="NuGet.Build.Packaging.Tasks.dll" />
2020

2121
<Import Project="NuGet.Build.Packaging.props" Condition="'$(NuGetBuildPackagingPropsImported)' == ''" />
22+
<!-- Adds compatibility targets with Pack SDK -->
23+
<Import Project="NuGet.Build.Packaging.Compatibility.targets" />
2224

2325
<PropertyGroup>
2426
<!-- The Kind of primary output (build, symbols and doc) set if IncludeOutputsInPackage = true -->
@@ -215,7 +217,7 @@ Copyright (c) .NET Foundation. All rights reserved.
215217
</InferPackageContentsDependsOn>
216218
<GetPackageContentsDependsOn>InferPackageContents</GetPackageContentsDependsOn>
217219
</PropertyGroup>
218-
220+
219221
<Target Name="GetPackageContents" DependsOnTargets="$(GetPackageContentsDependsOn)" Returns="@(_PackageContent)">
220222
<!-- We batch depending on the IsPackaging metadata, which is only specified for referenced content
221223
if the current project is building a package, to force retargeting of the referenced content. -->

0 commit comments

Comments
 (0)