Description
NuGet's pack now emits warning NU5052 when a package ID doesn't conform to the restricted character set that nuget.org enforces. The warning is gated by SdkAnalysisLevel >= 11.0.100 and currently applies to SDK-style projects only.
Version
.NET 11 Preview 6
Previous behavior
dotnet pack produced a package for any package ID accepted by the legacy ID rules, including IDs containing characters outside ASCII letters, digits, dots, and dashes, or with consecutive ./- characters.
New behavior
When packing on the .NET 11 SDK (SdkAnalysisLevel >= 11.0.100, first introduced in .NET 11 Preview 6), packing a package whose ID doesn't meet the restricted rules emits warning NU5052. A valid ID:
- Must start with a letter, digit, or underscore (
_)
- May contain only ASCII letters, digits, dots (
.), dashes (-), and underscores (_)
- Cannot contain consecutive
. or - characters
- Must be 100 characters or less
Type of breaking change
Reason for change
Under the covers, NuGet derives strings such as URLs and file-system paths from a normalized version of the package ID. Normalization relies on built-in string libraries that are inconsistent across .NET Framework, modern .NET, Windows, and Linux, so two visibly different IDs can normalize to the same string. Restricting the allowed character set (as npm, PyPI, and other registries have done) closes this security and branding gap.
Recommended action
Rename the package to an ID within the restricted character set — transliterate to ASCII (for example, Müller.Logging becomes Mueller.Logging) — then deprecate the old ID and point it at the new one.
Because this is a warning, suppression is implied: add <NoWarn>NU5052</NoWarn>, or set SdkAnalysisLevel below 11.0.100.
Feature area
SDK
Affected APIs
N/A (build-time NuGet diagnostic).
Associated WorkItem - 599251
Description
NuGet's
packnow emits warning NU5052 when a package ID doesn't conform to the restricted character set that nuget.org enforces. The warning is gated bySdkAnalysisLevel >= 11.0.100and currently applies to SDK-style projects only.Version
.NET 11 Preview 6
Previous behavior
dotnet packproduced a package for any package ID accepted by the legacy ID rules, including IDs containing characters outside ASCII letters, digits, dots, and dashes, or with consecutive./-characters.New behavior
When packing on the .NET 11 SDK (
SdkAnalysisLevel >= 11.0.100, first introduced in .NET 11 Preview 6), packing a package whose ID doesn't meet the restricted rules emits warning NU5052. A valid ID:_).), dashes (-), and underscores (_).or-charactersType of breaking change
Reason for change
Under the covers, NuGet derives strings such as URLs and file-system paths from a normalized version of the package ID. Normalization relies on built-in string libraries that are inconsistent across .NET Framework, modern .NET, Windows, and Linux, so two visibly different IDs can normalize to the same string. Restricting the allowed character set (as npm, PyPI, and other registries have done) closes this security and branding gap.
Recommended action
Rename the package to an ID within the restricted character set — transliterate to ASCII (for example,
Müller.LoggingbecomesMueller.Logging) — then deprecate the old ID and point it at the new one.Because this is a warning, suppression is implied: add
<NoWarn>NU5052</NoWarn>, or setSdkAnalysisLevelbelow11.0.100.Feature area
SDK
Affected APIs
N/A (build-time NuGet diagnostic).
Associated WorkItem - 599251