Reputation: 31
I have a Microsoft assembly name and class name (Microsoft.Crm.Asynchronous). How can I find out the name of Dll that this assembly resides.
I am instrumenting the performance of various dlls in App dynamics tool. I searched up and found ildasm.exe . But this is a disassembler of a DLL.
I want to know the dll. How can I know the name of the Microsoft Dll if I know one of the assembly name and class name in that dll?
thank you
Upvotes: 1
Views: 73
Reputation: 981
The Assembly.CodeBase
property will return the assembly's original location, even if it has been copied to a temporary location via shadow copying. You can use typeof(TypeName).Assembly
to access the assembly. As a complete example:
var dll = typeof(Microsoft.Crm.Asynchronous).Assembly.CodeBase;
The CodeBase property returns a string in a URI format, so you may want this instead to translate it to a regular path:
var dll = new Uri( typeof(Microsoft.Crm.Asynchronous).Assembly.CodeBase ).LocalPath;
If shadow copying isn't a concern for you, you can use Assembly.Location which is already a regular path.
Upvotes: 2