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

  • JoeAlbahari
    edited February 2018
    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);
    
  • albertcox
    edited March 2018
    Yes, this way is really easier! Thanks for it