Logo Questions Linux Laravel Mysql Ubuntu Git Menu
 

Getting the Assembly Qualified Name of a class in Visual Studio

I'm writing a customized reflective library for some specialized custom domain logic, and that library is going to use XML configuration files that will dynamically resolve System.Type objects at runtime. However, when writing the XML configuration files, it's a bit of a pain to write the types because they need to be fully qualified assembly names for Type.GetType() to resolve them. Is there a way to find out the AssemblyQualifiedName of an object in Visual Studio without resorting to writing a program to print them out to a file or standard out or anything like that ?

like image 518
Alex Marshall Avatar asked Apr 09 '10 22:04

Alex Marshall


2 Answers

If I were in your situation I would just popup the Immediate Window (Debug->Windows->Immediate) and use typeof(TypeFullName).AssemblyQualifiedName.

You need to qualify the type with the full namespace in order to do this and this also has the side effect of automatically running the solution startup project. This side effect can be mitigated by temporarily setting a class library as the solution startup project.

Example:

typeof(System.Windows.Forms.Button).AssemblyQualifiedName
like image 119
João Angelo Avatar answered Nov 09 '22 03:11

João Angelo


I'm gonna change my comment to a proper answer, because after having a quick play what i suggested does exactly what you want.

Download the free version of Reflector from here, unpack it and run it. Drag and drop a compiled version of your assembly on to it, and next to the Name tag in the info section at the bottom of the dialog will be its fully qualified name, ready for you to just copy and paste from there.

Note that all the info you need is also availableby right-clicking on the compiled file, select Properties, then go to the Details tab, although you can't just copy/paste from there.

like image 30
slugster Avatar answered Nov 09 '22 03:11

slugster