Fix Pack step failing on main after source generator#29
Merged
Conversation
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
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>
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment
Add this suggestion to a batch that can be applied as a single commit.This suggestion is invalid because no changes were made to the code.Suggestions cannot be applied while the pull request is closed.Suggestions cannot be applied while viewing a subset of changes.Only one suggestion per line can be applied in a batch.Add this suggestion to a batch that can be applied as a single commit.Applying suggestions on deleted lines is not supported.You must change the existing code in this line in order to create a valid suggestion.Outdated suggestions cannot be applied.This suggestion has been applied or marked resolved.Suggestions cannot be applied from pending reviews.Suggestions cannot be applied on multi-line comments.Suggestions cannot be applied while the pull request is queued to merge.Suggestion cannot be applied right now. Please check back later.
Summary
mainhas been failing since Add source generator for numeric wrapper boilerplate (#24) #25 withNETSDK1085: 'NoBuild' was true but 'Build' was invokedonStrongTypes.SourceGenerators.csproj.dotnet pack --no-buildstill resolvesProjectReferences, which invokes Build on the analyzer project and trips the NoBuild guard.--no-buildlets pack perform a no-op incremental build and succeed. Verified locally —Kalicz.StrongTypes.0.2.0.nupkgis 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
dotnet build -c Releasethendotnet pack ./src/StrongTypes/StrongTypes.csproj -c Release -o outsucceeds and emits the nupkg.maingoes green end-to-end.