You signed in with another tab or window. Reload to refresh your session.You signed out in another tab or window. Reload to refresh your session.You switched accounts on another tab or window. Reload to refresh your session.Dismiss alert
{{ message }}
Repository navigation
<IsPackable>false</IsPackable> in a library's .csproj is overwritten by Sdk.targets, so dotnet pack still produces and publishes the package (same for IsPublishable on Exes) #71
Sdk.targets is imported after the project body and after Directory.Build.targets. So a project can't opt a library out of packing, or an Exe out of publishing. Only a global -p:IsPackable=false on the command line survives. This contradicts CLAUDE.md's "MSBuild Evaluation Order" section, which says "Properties are set conditionally to avoid overwriting user-specified values."
With Version=1.0.0-pre.1 this still evaluates to IsPackable=true, for two reasons:
IsPrerelease is only defined in Sdk.targets, so it is empty while the project body is evaluated.
Line 37 would overwrite the result anyway.
Why it matters
A repository with an internal library it doesn't want published marks it IsPackable=false and reasonably expects it to stay unpublished. Examples are a shared test-helpers library, a benchmark harness, a generator consumed only through a project reference, or a sample library. The solution-level dotnet pack in CI still produces the .nupkg, and the release step pushes it to NuGet. Nothing warns about it, and a package on nuget.org can only be unlisted, never deleted.
Suggested fix
Derive the default only when the project hasn't chosen one. Sdk.props:609 already defaults IsPackable to false, so either:
leave it empty in props and use Condition="'$(IsPackable)' == '' And (...)" in targets, falling back to false; or
snapshot the props default in a private marker (the same pattern as _KtsuSdkDefaultTestTargetFrameworks) and only override while the value still equals that default.
Apply the same change to IsPublishable.
Fix or remove the README.md:706 example. IsPrerelease can't be read from the project body, so either document a targets-time hook or drop the example.
Acceptance criteria:
A library project setting IsPackable=false, in its .csproj or in Directory.Build.props/targets, evaluates to false, and dotnet pack produces no package.
An Exe setting IsPublishable=false keeps it.
Libraries and PackAsTool projects that don't set it are still packable by default.
Example-workspace tests cover both the opt-out and the default.
Priority: High. A project that explicitly opts out with IsPackable=false still gets packed and pushed to nuget.org by the shared release pipeline. That can't be undone: a published package can only be unlisted. This affects every consumer of ktsu.Sdk.
Area / suggested owner:Sdk/Sdk.targets derivation of IsPackable/IsPublishable, and Sdk.props defaults, plus README.md:706.
Duplicates: None found.
In progress: No open PR covers this.
Next step: Make the targets-time derivation conditional on the project not having set a value. Use the private-marker snapshot pattern already used for _KtsuSdkDefaultTestTargetFrameworks. Add example-workspace tests for both the opt-out and the default.
Activity
matt-edmondson commentedon Oct 5, 2026
Triage
IsPackable=falsestill gets packed and pushed to nuget.org by the shared release pipeline. That can't be undone: a published package can only be unlisted. This affects every consumer of ktsu.Sdk.Sdk/Sdk.targetsderivation ofIsPackable/IsPublishable, andSdk.propsdefaults, plus README.md:706._KtsuSdkDefaultTestTargetFrameworks. Add example-workspace tests for both the opt-out and the default.Generated by Claude Code