Skip to content

Fix Pack step failing on main after source generator#29

Merged
KaliCZ merged 1 commit intomainfrom
fix-pack-nobuild
Apr 17, 2026
Merged

Fix Pack step failing on main after source generator#29
KaliCZ merged 1 commit intomainfrom
fix-pack-nobuild

Conversation

@KaliCZ
Copy link
Copy Markdown
Owner

@KaliCZ KaliCZ commented Apr 17, 2026

Summary

  • The Pack step on main has been failing since Add source generator for numeric wrapper boilerplate (#24) #25 with NETSDK1085: 'NoBuild' was true but 'Build' was invoked on StrongTypes.SourceGenerators.csproj. dotnet pack --no-build still resolves ProjectReferences, which invokes Build on the analyzer project and trips the NoBuild guard.
  • Dropping --no-build lets pack perform a no-op incremental build and succeed. Verified locally — Kalicz.StrongTypes.0.2.0.nupkg is produced cleanly.

Why this wasn't caught in PR CI

The Pack step is gated on github.ref == 'refs/heads/main' && github.event_name == 'push', so PRs never exercise it. Both #25 and #26 merged green and broke main on the post-merge push. Worth a follow-up to also run Pack in PR CI so this can't recur.

Test plan

  • Local: dotnet build -c Release then dotnet pack ./src/StrongTypes/StrongTypes.csproj -c Release -o out succeeds and emits the nupkg.
  • CI on this PR stays green (Pack won't actually run here — still gated to main push).
  • After merge, the build-and-test run on main goes green end-to-end.

The main csproj has an Analyzer ProjectReference to
StrongTypes.SourceGenerators. With --no-build, pack still needs to
resolve project references and invokes the Build target on the
generator project, which then fails with NETSDK1085 because NoBuild is
set. Letting pack perform a (no-op incremental) build sidesteps this.

The Pack step only runs on main pushes, so PR CI never exercised it —
both #25 and #26 merged green and broke main. A follow-up should make
this fail fast in PR CI.

Co-Authored-By: Claude Opus 4.7 (1M context) <noreply@anthropic.com>
@KaliCZ KaliCZ self-assigned this Apr 17, 2026
@KaliCZ KaliCZ merged commit 19c36ec into main Apr 17, 2026
2 checks passed
@KaliCZ KaliCZ deleted the fix-pack-nobuild branch April 17, 2026 11:44
KaliCZ added a commit that referenced this pull request Apr 19, 2026
The main csproj has an Analyzer ProjectReference to
StrongTypes.SourceGenerators. With --no-build, pack still needs to
resolve project references and invokes the Build target on the
generator project, which then fails with NETSDK1085 because NoBuild is
set. Letting pack perform a (no-op incremental) build sidesteps this.

The Pack step only runs on main pushes, so PR CI never exercised it —
both #25 and #26 merged green and broke main. A follow-up should make
this fail fast in PR CI.

Co-authored-by: Claude Opus 4.7 (1M context) <noreply@anthropic.com>
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