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

Nuget list command is not working #778

Open
ramannikhil opened this issue Aug 9, 2023 · 10 comments
Open

Nuget list command is not working #778

ramannikhil opened this issue Aug 9, 2023 · 10 comments

Comments

@ramannikhil
Copy link

I'm trying to use the below command for the list of the packages in my local feed, but it's not working maybe due to this HTTP endpoint,
nuget list -Source http://localhost:5000/v3/index.json

How can I add or use the HTTPS endpoint for this?

@Regenhardt
Copy link

HTTP shouldn't be a critical issue yet, nuget will only deactivate it in november.

@Regenhardt
Copy link

Can you go to that URL using your browser?

@ramannikhil
Copy link
Author

{ "version": "3.0.0", "resources": [ { "@id": "http://localhost:5000/api/v2/package", "@type": "PackagePublish/2.0.0" }, { "@id": "http://localhost:5000/api/v2/symbol", "@type": "SymbolPackagePublish/4.9.0" }, { "@id": "http://localhost:5000/v3/search", "@type": "SearchQueryService" }, { "@id": "http://localhost:5000/v3/search", "@type": "SearchQueryService/3.0.0-beta" }, { "@id": "http://localhost:5000/v3/search", "@type": "SearchQueryService/3.0.0-rc" }, { "@id": "http://localhost:5000/v3/registration", "@type": "RegistrationsBaseUrl" }, { "@id": "http://localhost:5000/v3/registration", "@type": "RegistrationsBaseUrl/3.0.0-rc" }, { "@id": "http://localhost:5000/v3/registration", "@type": "RegistrationsBaseUrl/3.0.0-beta" }, { "@id": "http://localhost:5000/v3/package", "@type": "PackageBaseAddress/3.0.0" }, { "@id": "http://localhost:5000/v3/autocomplete", "@type": "SearchAutocompleteService" }, { "@id": "http://localhost:5000/v3/autocomplete", "@type": "SearchAutocompleteService/3.0.0-rc" }, { "@id": "http://localhost:5000/v3/autocomplete", "@type": "SearchAutocompleteService/3.0.0-beta" } ] }

I can see this in my browser.

One more thing that I tried in my local machine is one of my projects uses port:5000, to modify this I cloned the source code and update the end the point to some random available port number, I used nuget pack Baget.Nuspec that generated the bunch of compiled dll's, I replaced the updated Baget.dll in my current Baget Folder, but no luck it didn't work, any suggestions on this ? Please let me know, Is there any way around to use command like dotnet ./Baget.dll --port:54321

@Regenhardt
Copy link

If you get the json, it should be working for the nuget client too. What exactly isn't working, what reaction do you get from nuget?

@ramannikhil
Copy link
Author

PS C:\Users\<User_Name> > nuget list -Source "http://localhost:5000/v3/index.json" WARNING: This version of nuget.exe does not support listing packages from package source 'http://localhost:5000/v3/index.json'. WARNING: You are running the 'list' operation with an 'HTTP' source, 'localfeed [http://localhost:5000/v3/index.json]'. Non-HTTPS access will be removed in a future version. Consider migrating to an 'HTTPS' source. No packages found.
sorry if I confused you, I'm trying to run this command nuget list -source "http://localhost:5000/v3/index.json" but it shows No packages found, This is what I'm trying to resolve, FYI NuGet Version: 6.6.0.61, For any given nuget source feed this command should work right? Please let me know on this

@Regenhardt
Copy link

Seems like it does interact with BaGet, but doesn't find any packages. Are there packages pushed to your local BaGet instance? What if you push a new one, is it found by nuget immediately after pushing?

@ramannikhil
Copy link
Author

image

PS C:\Users\<my_user_name>\source\personal_repo\CircleCITestPackage_Dotnet_4.7> dotnet nuget push -s http://localhost:5000/v3/index.json "C:\Users\<my_user_name>\source\personal_repo\CircleCITestPackage_Dotnet_4.7\Package.Custom_Nikhil.1.0.0.nupkg" warn : You are running the 'push' operation with an 'HTTP' source, 'http://localhost:5000/v3/index.json'. Non-HTTPS access will be removed in a future version. Consider migrating to an 'HTTPS' source. warn : No API Key was provided and no API Key could be found for 'http://localhost:5000/api/v2/package'. To save an API Key for a source use the 'setApiKey' command. Pushing Package.Custom_Nikhil.1.0.0.nupkg to 'http://localhost:5000/api/v2/package'... warn : You are running the 'push' operation with an 'HTTP' source, 'http://localhost:5000/api/v2/package/'. Non-HTTPS access will be removed in a future version. Consider migrating to an 'HTTPS' source. PUT http://localhost:5000/api/v2/package/ Created http://localhost:5000/api/v2/package/ 277ms Your package was pushed.

I was able to push & delete the nuget packages using nuget commands, attaching the ref logs and image

@fourpastmidnight
Copy link

I'm having the same problem. I was using a nuget.exe client of 5.4.x. I thought maybe it was the client version (since the error message said so, but that's bogus apparently) and so I updated to v6.70.x. Still no dice, and I'm getting the exact same message as the OP.

FWIW, we're switching to Artifactory because we have several Baget instances at this point and need to consolidate. To make the transition much easier, I was hoping to basically "proxy" Baget using an Artifactory Remote repository. But without the list verb working, this won't work at all. 😢

@fourpastmidnight
Copy link

So, I just built from the latest sources and deployed the application.

Issuing the command:

nuget list -source http://my-baget-server/v3/index.json

resulted in the same error as the OP.

Issuing the following command instead:

nuget list http://my-baget-server/

resulted in the following output:

The V2 feed at 'http://my-baget-server/Search()?$filter=IsLatestVersion&$orderby=Id&searchTerm=''&targetFramework=''&includePrerelease=false&$skip=0&$top=30&semVerLevel=2.0.0' returned an unexpected status code '404 Not Found'.
NativeCommandExitException: Program "NuGet.exe" ended with non-zero exit code: 1.

So, listing packages, either using the v2 or v3 nuget apis does not work.

Issuing a search command instead (for v3 API) does work. But I don't want to search, I want to list the packages.

@fourpastmidnight
Copy link

And now I've confirmed Baget's behavior vs. nuget.org when using the nuget.exe client via MITM Proxy (Man-in-the-middle). When nuget.exe is used to perform a list against nuget.org, the resource https://api.nuget.org/v3/index.json is requested and returned. Then a request is made to https://www.nuget.org/api/V2, followed by https://www.nuget.org/api/V2/$metadata. Eventually, a search request using the V2 API is used, as in my attempt to perform an "empty search" against baget shows above, only, nuget.org actually returns results. So, a list is nothing more than a search without any specific package id being mentioned in the request. Of course, when performing a list, you can also specify a package id, e.g. Newtonsoft, and all packages which reference a package containing the name NewtonSoft, or any package with NewtonSoft in its ID is returned--again, a search with a specific search term.

It appears that Baget does not support any of the V2 API, and so list is NOT supported, as pointed out in #455, which I misread to understand that listing was now supported--it is not. Only listing a specific package's versions contained within a Baget instance is supported, and that by the Baget.SDK (which probably results in some sort of v3 search API call).

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

No branches or pull requests

3 participants