Skip to content
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension


Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
2 changes: 1 addition & 1 deletion src/Directory.Build.targets
Original file line number Diff line number Diff line change
Expand Up @@ -39,7 +39,7 @@
<NuGetBuildTasksPackTargets Condition="'$(NuGetBuildTasksPackTargets)' == ''">$(MSBuildSDKsPath)\..\NuGet.Build.Tasks.Pack.targets</NuGetBuildTasksPackTargets>
</PropertyGroup>

<Import Project="$(NuGetBuildTasksPackTargets)" Condition="Exists('$(NuGetBuildTasksPackTargets)')"/>
<Import Project="$(NuGetBuildTasksPackTargets)" Condition="Exists('$(NuGetBuildTasksPackTargets)') And '$(NuGetize)' != 'true'" />

<PropertyGroup>
<!-- Revert the forced PackageId by the NuGet SDK targets for non-packable projects, see https://github.com/NuGet/Home/issues/14928 -->
Expand Down
20 changes: 20 additions & 0 deletions src/Directory.targets
Original file line number Diff line number Diff line change
Expand Up @@ -13,4 +13,24 @@
<PackFolderKindFile>$(IntermediateOutputPath)PackFolderKind.g$(DefaultLanguageSourceExtension)</PackFolderKindFile>
</PropertyGroup>

<!--
Robust Pack delegation for NuGetizer itself (and similar PackFolder=build projects).
"dotnet pack" (and GeneratePackageOnBuild=true scenarios) must go through NuGetize=true
so that NuGetizer's inference + PackFolder=build logic classifies the *.props/*.targets
into build/ + buildMultiTargeting/ instead of the SDK pack's default content/contentFiles handling.
This definition is late (in Directory.targets) so it wins over the SDK pack target's definition
that was forcibly imported to workaround PackageId defaults.
-->
<Target Name="Pack"
Condition="'$(NuGetize)' != 'true' and ('$(PackFolder)' == 'build' or '$(PackFolder)' == 'buildTransitive' or '$(MSBuildProjectName)' == 'NuGetizer.Tasks')"
Returns="@(PackOutput)">
<MSBuild Projects="$(MSBuildProjectFullPath)"
UnloadProjectsOnCompletion="true"
UseResultsCache="false"
Properties="NuGetize=true;GeneratePackageOnBuild=false"
Targets="Pack">
<Output TaskParameter="TargetOutputs" ItemName="PackOutput" />
</MSBuild>
</Target>

</Project>
2 changes: 1 addition & 1 deletion src/NuGetizer.Tasks/NuGetizer.Tasks.Pack.targets
Original file line number Diff line number Diff line change
@@ -1,7 +1,7 @@
<Project>

<!-- GeneratePackageOnBuild=false is used by VS when right-click Pack is used :) -->
<Target Name="Pack" Condition="'$(GeneratePackageOnBuild)' == 'false' AND '$(NuGetize)' != 'true'" Returns="@(PackOutput)">
<Target Name="Pack" Condition="'$(NuGetize)' != 'true'" Returns="@(PackOutput)">
<!-- Typically called in the IDE when we run Pack context menu. -->
<MSBuild Projects="$(MSBuildProjectFullPath)" UnloadProjectsOnCompletion="true" UseResultsCache="false"
Properties="NuGetize=true" Targets="Pack">
Expand Down
10 changes: 9 additions & 1 deletion src/NuGetizer.Tasks/NuGetizer.Tasks.csproj
Original file line number Diff line number Diff line change
Expand Up @@ -45,6 +45,14 @@

<ItemGroup>
<None Update="@(None)" CopyToOutputDirectory="PreserveNewest" Pack="true" />
<!--
Explicit PackagePath for our build assets so they reliably go under build/ (not content)
no matter if inference or the SDK pack ends up driving the actual packaging.
PackagePath takes precedence.
-->
<None Update="*.props;*.targets;*.tasks;NuGetizer.*.props;NuGetizer.*.targets;NuGetizer.*.tasks;dotnet-nugetize.*;NuGetizer.Shared.targets;NuGetizer.Cleanup.targets;NuGetizer.Compatibility.props;NuGetizer.Inference.*;NuGetizer.Authoring.*;NuGetizer.PackageValidation.targets;NuGetizer.PackageMetadata.targets;NuGetizer.Version.props;NuGetizer.Tasks.Pack.targets"
PackagePath="build\%(Filename)%(Extension)" />
<!-- Specific overrides for the buildMultiTargeting copies -->
<None Update="NuGetizer.MultiTargeting.props" PackagePath="buildMultiTargeting\NuGetizer.props" />
<None Update="NuGetizer.MultiTargeting.targets" PackagePath="buildMultiTargeting\NuGetizer.targets" />
<None Include="NuGetizer.PackageMetadata.targets;dotnet-nugetize.props;dotnet-nugetize.targets" PackagePath="buildMultiTargeting\%(Filename)%(Extension)" Pack="true" />
Expand All @@ -60,7 +68,7 @@
<EmbeddedResource Update="Resources.resx" Generator="" />
</ItemGroup>

<Import Project="NuGetizer.Tasks.Pack.targets" Condition="'$(GeneratePackageOnBuild)' == 'false' AND '$(NuGetize)' != 'true'" />
<Import Project="NuGetizer.Tasks.Pack.targets" Condition="'$(NuGetize)' != 'true'" />
<Import Project="NuGetizer.Tasks.targets" />
<Import Project="..\ILRepack.targets" />
</Project>
Loading