Add Connection to Nuget

How do I make a connection to Nuget so I can run LINQ queries on packages. I have the latest Linqpad 5 (Premium Edition). I have tried an OData 4 connection but just get errors.

Comments

  • edited February 28
    The easiest way is to add a NuGet package reference to NuGet.Core and run a query like this:
    var repo = PackageRepositoryFactory.Default.CreateRepository("https://nuget.org/api/v2");
    
    IQueryable<IPackage> packages = repo.GetPackages();
    
    // or:
    IQueryable<IPackage> packages = repo.Search ("<search terms>", true);
    
  • edited March 23
    Yes, this way is really easier! Thanks for it
Sign In or Register to comment.

Howdy, Stranger!

It looks like you're new here. If you want to get involved, click one of these buttons!