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

Commit c1a64fa

Browse files
authored
If EmitNuSpec=false, don't set NuspecFile so that Pack does not write the nuspec
1 parent 1a65ddd commit c1a64fa

1 file changed

Lines changed: 3 additions & 5 deletions

File tree

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

Lines changed: 3 additions & 5 deletions
Original file line numberDiff line numberDiff line change
@@ -38,7 +38,8 @@ Copyright (c) .NET Foundation. All rights reserved.
3838

3939
<!-- Whether to emit the nuspec that's used to create the final package -->
4040
<EmitNuSpec Condition="'$(EmitNuSpec)' == ''">false</EmitNuSpec>
41-
<NuspecFile Condition="'$(NuspecFile)' == ''">$(OutputPath)\$(PackageId).nuspec</NuspecFile>
41+
<!-- Only default the nuspec file if we are supposed to emit one. -->
42+
<NuspecFile Condition="'$(NuspecFile)' == '' and '$(EmitNuSpec)' == 'true'">$(OutputPath)\$(PackageId).nuspec</NuspecFile>
4243
</PropertyGroup>
4344

4445
<Import Project="NuGet.Build.Packaging.Inference.targets" Condition="'$(InferPackageContents)' != 'false'" />
@@ -373,9 +374,6 @@ Copyright (c) .NET Foundation. All rights reserved.
373374
-->
374375
<Target Name="Pack" DependsOnTargets="$(PackDependsOn)" Returns="@(PackageTargetPath)" Condition="'$(IsPackable)' == 'true'">
375376
<MakeDir Directories="$(PackageOutputPath)" Condition="!Exists('$(PackageOutputPath)')" />
376-
<PropertyGroup>
377-
<NuspecFile Condition="'$(EmitNuspec)' == 'true' And '$(NuspecFile)' == ''">$(OutputPath)\$(PackageId).nuspec</NuspecFile>
378-
</PropertyGroup>
379377
<CreatePackage Manifest="@(PackageTargetPath)" NuspecFile="$(NuspecFile)" Contents="@(_PackageContent)" TargetPath="@(PackageTargetPath->'%(FullPath)')">
380378
<Output TaskParameter="OutputPackage" ItemName="_PackageTargetPath" />
381379
<Output TaskParameter="OutputPackage" ItemName="FileWrites" />
@@ -402,4 +400,4 @@ Copyright (c) .NET Foundation. All rights reserved.
402400
<Import Project="NuGet.Build.Packaging.Authoring.targets" Condition="'$(IsPackagingProject)' == 'true'" />
403401
<Import Project="NuGet.Build.Packaging.CrossTargeting.targets" Condition="'$(IsCrossTargetingBuild)' == 'true' And '$(FromPackagingProject)' == 'true'" />
404402
<Import Project="NuGet.Build.Packaging.Legacy.targets" />
405-
</Project>
403+
</Project>

0 commit comments

Comments
 (0)