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.
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.
There are some tools like ReSharper that will suggest adding using
statements and even add a reference to the project. It seems you don't have something like that.
In that case (before I had tools), I google for
class <ClassName> site:msdn.microsoft.com
eg
class Process site:msdn.microsoft.com
which brings me to the Process class . On the MSDN page, it lists the namespace and assembly:
Namespace: System.Diagnostics
Assembly: System (in System.dll)
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.
The technical post webpages of this site follow the CC BY-SA 4.0 protocol. If you need to reprint, please indicate the site URL or the original address.Any question please contact:yoyou2525@163.com.