Working on modifying an existing .NET project. Given a C# class in Visual Studio, how can I find out which DLL has it?
The problem is that I want to use a method in this class in a new project so I need to find the correct DLL to add as a reference for the new project.
Search for your class name in the object browser (Menu View -> Object Browser). The assembly information window will contain the dll complete path.
This can be rather frustrating and irritating - I found myself in a situation where I needed an answer to the OP's question and none of the above answers worked for me.
I had a program that imported some Roslyn DLLs. Later, after I'd become unsure as to which DLLs were really necessary, I was trying to find out which classes were in which DLLs.
For example, my program referenced class MSBuildWorkspace
. Navigating to the class declaration I can see the namespace name, and the fully qualified name of the class is Microsoft.CodeAnalysis.MSBuild.MSBuildWorkspace
.
Opening the Object Browser, as suggested by @Spell, and searching for Microsoft.CodeAnalysis.MSBuild.MSBuildWorkspace
results in "Search found no results", which I'm guessing must be due to a bug in Visual Studio.
Fortunately, searching for just MSBuildWorkspace
does find the class, but it still didn't tell me which DLL contains the class.
So what I needed to do was to click on the class name, which is shown as a link, in the smallish panel in the lower right part of Object Browser. This results in the left panel switching to a view of the DLLs and the classes they contain. Now I could see that class MSBuildWorkspace
was in DLL Microsoft.CodeAnalysis.Workspaces
, and right-clicking on that and selecting Copy and pasting the result into a text editor provided the full path to the DLL.
You can see the assembly in the project properties. The output name of the DLL (which is what a Class Library project produces) is specified in there.
If you love us? You can donate to us via Paypal or buy me a coffee so we can maintain and grow! Thank you!
Donate Us With