Skip to content

Commit

Permalink
Make sure the output package cleanup happens before Pack
Browse files Browse the repository at this point in the history
When using dotnet build, the ordering is slightly different than msbuild, so adding to PackDependsOn is more reliable.

Fixes #22
  • Loading branch information
kzu committed Oct 29, 2020
1 parent e1db917 commit 0ab59f7
Showing 1 changed file with 5 additions and 1 deletion.
6 changes: 5 additions & 1 deletion src/NuGetizer.Tasks/NuGetizer.Cleanup.targets
Original file line number Diff line number Diff line change
Expand Up @@ -17,9 +17,13 @@ Copyright (c) .NET Foundation. All rights reserved.
<CleanHttpNuGetCacheOnPack Condition="'$(CleanHttpNuGetCacheOnPack)' == ''">true</CleanHttpNuGetCacheOnPack>
<!-- The actual NuGet cache is only cleared for the *current* PackageId, so no need to turn off its clearing on build/pack -->
<NuGetCache>$(UserProfile)\.nuget\packages</NuGetCache>
<PackDependsOn>
CleanPackageOutput;
$(PackDependsOn);
</PackDependsOn>
</PropertyGroup>

<Target Name="CleanPackageOutput" BeforeTargets="Build">
<Target Name="CleanPackageOutput">
<ItemGroup>
<_ExistingPackage Include="$(PackageOutputPath)\$(PackageId)*.nupkg" />
<_PackageToDelete Include="@(_ExistingPackage)"
Expand Down

0 comments on commit 0ab59f7

Please sign in to comment.