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
Restore fails with NU1013 in every non-test project when a repo sets CentralPackageVersionOverrideEnabled=false: the SDK's implicit ktsu.Sdk.Analyzers reference uses VersionOverride #105
NuGet documents CentralPackageVersionOverrideEnabled=false as the Central Package Management switch that forbids VersionOverride, so that every version comes from Directory.Packages.props. When a repository turns it on, the SDK's own implicit reference breaks restore.
Repro
Enable CPM and add <CentralPackageVersionOverrideEnabled>false</CentralPackageVersionOverrideEnabled> to Directory.Packages.props in a ktsu.Sdk library repo, then run dotnet build:
error NU1013: The following PackageReference items cannot specify a value for VersionOverride: ktsu.Sdk.Analyzers.
The consumer can't work around it short of turning the hardening switch back off. A PackageVersion entry for ktsu.Sdk.Analyzers doesn't help, because the item still carries VersionOverride.
Fix verified locally: with the cached Sdk.targets edited to <PackageReference Include="ktsu.Sdk.Analyzers" Version="{version}" IsImplicitlyDefined="true" …>, restore and build succeed with overrides disabled, and also with CPM in its default state. CPM off already works today.
Suggested fix / acceptance criteria
Reference the analyzer with Version="{version}" plus IsImplicitlyDefined="true". That is how the .NET SDK adds its own implicit packages under CPM, and NuGet then skips the central-version requirement.
Add a regression example or test that sets CentralPackageVersionOverrideEnabled=false and builds.
Make sure KTSU0005 (orphaned PackageVersion) and KTSU0008 still behave as before for that item.
Priority: Medium. It only hits repos that opt into the CentralPackageVersionOverrideEnabled=false hardening switch, but those repos have no workaround short of turning the switch off. The fix is small and already verified locally.
Activity
matt-edmondson commentedon Nov 5, 2026
Triage
CentralPackageVersionOverrideEnabled=falsehardening switch, but those repos have no workaround short of turning the switch off. The fix is small and already verified locally.Sdk.targetsimplicit analyzer referenceVersionOverride: the diagnostic never clears and the fix only addsNoWarn="NU1510"#77, where KTSU0008's code fix ignoresVersionOverride, so check KTSU0005 and KTSU0008 together when switching toIsImplicitlyDefined.Generated by Claude Code