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

Commit 1b63d35

Browse files
kzuadalon
authored andcommitted
Make Pack depend on Build when project is packable
We were previously depending on just CoreBuild. Make it so that doing a `msbuild /p:PackOnBuild=true` == `msbuild /t:Pack`, which should fix issue NuGet/Home#4777
1 parent 5e77c83 commit 1b63d35

1 file changed

Lines changed: 6 additions & 3 deletions

File tree

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

Lines changed: 6 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -451,12 +451,15 @@ Copyright (c) .NET Foundation. All rights reserved.
451451
</PropertyGroup>
452452

453453
<PropertyGroup>
454-
<BuildDependsOn Condition="('$(PackOnBuild)' == 'true' Or Exists('$(PackOnBuildFile)')) and '$(IsPackable)' == 'true'">
454+
<!-- If we're packing on build, just add Pack as a dependency for Build -->
455+
<_ShouldPackOnBuild Condition="('$(PackOnBuild)' == 'true' Or Exists('$(PackOnBuildFile)')) And '$(IsPackable)' == 'true'">true</_ShouldPackOnBuild>
456+
<BuildDependsOn Condition="'$(_ShouldPackOnBuild)' == 'true'">
455457
$(BuildDependsOn);
456458
Pack;
457459
</BuildDependsOn>
458-
<PackDependsOn Condition="'$(IsPackagingProject)' != 'true'">
459-
CoreBuild;
460+
<!-- If we're not packing on build, set up a dependency from Pack>Build for non-NuProj that are packable, so Build runs before Pack -->
461+
<PackDependsOn Condition="'$(IsPackagingProject)' != 'true' And '$(_ShouldPackOnBuild)' != 'true' And '$(IsPackable)' == 'true'">
462+
Build;
460463
</PackDependsOn>
461464
<PackDependsOn>
462465
$(PackDependsOn)

0 commit comments

Comments
 (0)