views:

167

answers:

3

Hello,

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 ?

A: 

I'm not sure if I understood the problem. You want to get full names of your types programmatically? If so, you can always use typeof(YourType).FullName or typeof(YourType).AssemblyQualifiedName.

What I can think of is marking all of types you need with some custom atribute to easyly find them in the assemblies to extract their names, I don't think you can find some way without going through each of the type you need to extract its name.

Andrew Bezzub
No, I don't want to get them programmatically, I already know how to do that. I want to know if there's a way to find out the AssemblyQualifiedName of a class in visual studio without resorting to using code to print out the names of my classes, because I'm going to have to use the Type.AssemblyQualifiedName in configuration files
Alex Marshall
A: 

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
João Angelo
+3  A: 

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.

slugster
Not technically the AssemblyQualifiedName, but close enough. Thank you very much for your help.
Alex Marshall