How to find the nuget package that contains an assembly?

Viewed 1787

I feel like a) I should know the answer already and b) this would be a common question, but I can't find the answer.

I want to use Microsoft.AspNetCore.Http.HttpRequest in a .NET Standard 2.0 class library project. Ok, I guessed I might need the Microsoft.AspNetCore package, but no that class isn't in any assembly in there apparently.

I can go on MSDN and see that the HttpRequest class is in

Namespace:
Microsoft.AspNetCore.Http
Assembly:
Microsoft.AspNetCore.Http.Abstractions.dll

So how do I find the package that holds Microsoft.AspNetCore.Http.Abstractions.dll?

I'm asking for the methodology, not just the package.

3 Answers

From within Visual Studio, you can open the Nuget Package Manager and search for the class you want to use and the results will populate with the package you need.

Unfortunately, it doesn't seem Microsoft has provided a way to see exactly what assemblies are included in a package, but the publisher will sometimes include that information in the package description, like Microsoft has in the example below:

For Microsoft released packages for the framework the naming is pretty simple, the name of the dll is the name of the package so the place to find Microsoft.AspNetCore.Http.Abstractions.dll is Microsoft.AspNetCore.Http.Abstractions

Related