Note
Access to this page requires authorization. You can try signing in or changing directories.
Access to this page requires authorization. You can try changing directories.
Scenario
Invalid package id :
contoso../id.
Issue
The package ID is invalid because it does not match the required format. NuGet validates package IDs using this regex:
^\w+([.-]\w+)*$
- The ID must start with a letter or number.
- It can only contain letters, numbers, dots (
.), and dashes (-). - Dots or dashes must be followed by more letters or numbers.
- You can have multiple parts separated by
.or-, likeContoso.App.Service.
Solution
To fix this error:
- Replace or remove any invalid characters from the package ID. Only letters, numbers, dots (
.), and dashes (-) are allowed. - Ensure the package ID starts with a letter or number.
- Dots (
.) or dashes (-) must always be followed by another letter or number (no consecutive dots/dashes, and none at the end). - For example, change
contoso../idtoContoso.Id.
Valid:
<PackageReference Include="Contoso.Id" Version="1.0.0" />
Invalid:
<PackageReference Include="contoso../id" Version="1.0.0" />