Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Typo in PackageReference leads to less-than-helpful error message #14053

Open
Peter-LaComb opened this issue Jan 20, 2025 · 1 comment
Open

Comments

@Peter-LaComb
Copy link

NuGet Product Used

dotnet.exe

Product Version

9.0.1

Worked before?

No response

Impact

It bothers me. A fix would be nice

Repro Steps & Context

A PackageReference with a typo can lead to a confusing and less-than-helpful error message.

I inadvertently added a period (.) to the end of a package name before doing a dotnet build and was left thinking that Nuget.org was having issues.

I added:
<PackageReference Include="Swashbuckle.AspNetCore." Version="7.2.0" />
when I meant to add:
<PackageReference Include="Swashbuckle.AspNetCore" Version="7.2.0" />

The trailing period (,) in the package name causes this error:

C:\Program Files\dotnet\sdk\9.0.102\NuGet.targets(170,5): error : The feed 'nuget.org [https://api.nuget.org/v3/index.json]' lists package 'Swashbuckle.AspNetCore..7.2.0' but multiple attempts to download the nupkg have failed. The feed is either invalid or required packages were removed while the current operation was in progress. Verify the package exists on the feed and try again.

IMHO - This would be more helpful if it said the package could not be found. Clearly the "Found" package matched a string trimmed of the extra period. That or whatever matching logic was used should return a 'corrected' package name that is then passed to the code that downloads the package.

It might also be helpful if the message listed the package name and version number separately - I kept overlooking the double period between package name and version.

Verbose Logs

@jeffkl
Copy link
Contributor

jeffkl commented Jan 21, 2025

Thanks for the suggestion, we'll discuss internally and triage accordingly. It looks like the feed only responds with the available versions and doesn't indicate that the package ID is incorrect

https://api.nuget.org/v3-flatcontainer/swashbuckle.aspnetcore./index.json

Ideally, the feed would respond with the actual name or not respond with any package versions at all.

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Projects
None yet
Development

No branches or pull requests

2 participants