Open afcruzs opened 5 years ago
This is a tricky problem by itself as many NuGet packages may have that exact assembly. Personally I would recommend building a custom tool that uses the NuGet package content API to discover the versions for a package. Then, I would download each package and check each assembly individually. You should be able to do this using the NuGet client libraries or my BaGet.Protocol
package:
NuGetClient client = new NuGetClient("https://api.nuget.org/v3/index.json");
IReadOnlyList<NuGetVersion>> versions = await client.ListPackageVersionsAsync("Newtonsoft.Json");
foreach (NuGetVersion version in versions)
{
using (Stream packageStream = await client.GetPackageStreamAsync(packageId, packageVersion))
{
// You'll want to copy the packageStream to a seekable stream
// You'll want to use the "PackageArchiveReader" type from "NuGet.Packaging" to inspect the package stream and extract DLLs
}
}
Yep, that was my first thought. Thanks Ioic I'll take a look to BaGet.
I am considering indexing APIs however which would include the assembly name so it's not out of the question. Even if there are collisions it still might be a useful query to have.
I've been on situations where given a package name and an assembly version I need to figure out the nuget version. Do you think it would be appropriate to add that feature to fuget or is it out of scope?