Skip to content

fix: support robust NuGetize pack delegation for PackFolder=build projects#39

Merged
kzu merged 1 commit into
mainfrom
fix/nugetize-pack-delegation
Jun 24, 2026
Merged

fix: support robust NuGetize pack delegation for PackFolder=build projects#39
kzu merged 1 commit into
mainfrom
fix/nugetize-pack-delegation

Conversation

@kzu

@kzu kzu commented Jun 24, 2026

Copy link
Copy Markdown
Member

Problem

Projects using NuGetizer + PackFolder=build (the standard way to author MSBuild/ tool packages) would get their assets incorrectly placed under content/ + contentFiles/ when packed via dotnet pack.

This is the same root cause that affected the nugetizer 1.4.8 release.

Root cause

  • The shared Directory.Build.targets always imported the real NuGet.Build.Tasks.Pack.targets.
  • "dotnet pack" flows did not reliably go through the NuGetize=true path.
  • Result: SDK pack defaults won instead of NuGetizer's PackFolder inference.

Fix

  • Condition the import of the real pack targets: And '$(NuGetize)' != 'true'. When a project opts into NuGetizer via NuGetize, don't pull in the conflicting SDK pack targets.
  • Add a late <Target Name="Pack"> delegator (after the pack import) that, for any project with PackFolder=build or buildTransitive, re-invokes MSBuild with NuGetize=true. This guarantees the correct packaging logic runs.

The delegator is declared late in the file so it takes precedence.

See also the consuming change in devlooped/nugetizer#726

When a project sets NuGetize=true (to use NuGetizer for packaging),
avoid importing the real NuGet.Build.Tasks.Pack.targets. This prevents
the SDK pack flow from interfering with NuGetizer's own Pack target
and inference for PackFolder=build projects.

The unconditional import was causing assets to be collected as content
instead of build/.

This change belongs in the shared oss templates so all consuming repos
benefit.
@kzu kzu force-pushed the fix/nugetize-pack-delegation branch from 9471d18 to 0c0e035 Compare June 24, 2026 23:54
@kzu kzu merged commit dcd5f0a into main Jun 24, 2026
1 check passed
@kzu kzu deleted the fix/nugetize-pack-delegation branch June 24, 2026 23:55
github-actions Bot pushed a commit to jani-stack/oss that referenced this pull request Jun 25, 2026
# devlooped/oss

- Improve default rendering of header icon devlooped@9db26e2
- Update branches for push event in build.yml devlooped@5da103c
- Revert indent size for project files devlooped@a62c459
- Refactor GitHub Actions workflows to use unified PR_TOKEN for authentication and add skip PR creation warning devlooped@7c1c6e6
- Ensure dnx run succeeds even on Windows devlooped@7f5f9ee
- Skip discussion issues when generating changelog devlooped@08d83cb
- Ensure lf for Scriban templates always devlooped@4a9aa32
- Major revamp, focused on GH devlooped@0683ee7
- Cap rate limit wait at 5 minutes, abort if longer devlooped@61a602f
- Enhance documentation instructions for project work devlooped@e616d89
- Update to checkout@v4 devlooped@5fb1723
- Fix PackageId default from Pack SDK devlooped@6e24389
- Add 'agent-tools' to .gitignore devlooped@ff61659
- Add OpenTelemetry patterns to dependabot config devlooped@387f061
- Add explicit write permissions from caller workflow devlooped@8fa147d
- fix: support robust NuGetize pack delegation for PackFolder=build projects (devlooped#39) devlooped@dcd5f0a
- Ignore slnx file format too devlooped@68b409c
- If we provide a docs category, don't exclude docs :) devlooped@0c23e24
- Update nuget.config with new(ish?) MS certs devlooped@032439d

# devlooped/.github

- Add reusable OSMF EULA template devlooped/.github@666a2a7
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

None yet

Projects

None yet

Development

Successfully merging this pull request may close these issues.

1 participant