How to see public classes/methods for installed nuget dll

Viewed 49

Let's say I have installed a nuget in my (C#) project by using

<ItemGroup>
    <PackageReference Include="some.nuget" Version="1.2.3" />
</ItemGroup>

in an SDK-style project.

Let's say I have no access to any document describing that API or person who knows about it. I need to figure out on my own what public classes/methods there are.

How do I do that?

In other words: Where does an IDE (like Visual Studio or Visual Studio Code) get the data from, which it uses for IntelliSense?


In the installed nuget folder C:\Users\myUserName\.nuget\packages\some.nuget\1.2.3 is just some nuget metadata and the dll file. I know the information I need is inside the dll file, and I know that I can decompile it with some decompilation tool like ILSpy, but I doubt this is what the IDEs are doing. There must be a more straightforward way, right?

1 Answers

Checking it programmatically

First you load up your dll:

var assembly = Assembly.LoadFrom(filename);

Then you can reflect all classes as is answered in: C#: List All Classes in Assembly

With that output you can reflect all methods as is answered in: Get private Properties/Method of base-class with reflection

Checking it manually

You are looking for the Object explorer. This can be found be typing "Object" in the general purpose search bar (ctrl + q) in Visual Studio and picking the one called "Object Browser" enter image description here

There you have an overview of all the projects and packages in your solution. If you for instance want to know what the AutoFixture NuGet package exposes you just click on it and browse. Nuget package in Object explorer

Related