You are plugging away at writing this super sweet class, to be used in your latest application, and then you hit the wall! Nothing builds because the configuration file requires a reference to the fully qualified assembly name…ugh!!!
The first thing you do is scratch your inner mind trying to recall what makes up this name. (At least that is what I end up doing every time.) It seems depending on what you are working on you will either need a four-part name or a ‘five-part name’.
The four-part fully qualified name consists of the following in the following order:
Assembly Name, Version= 0.0.0.0, Culture=culture code, PublicKeyToken=public key
(It is common for culture to be set to ‘neutral’ if there is nothing contained that is specific to a cultural style.)
What I consider the to be the five-part name is the four-part name with the namespace and class name that is being referenced prefixed.
Namespace.Class Name, Assembly Name, Version=0.0.0.0, Culture=culture code, PublicKeyToken= public key
With the background details explained, how as a lazy programmer can we retrieve the fully qualified name without a lot of clicks? The old stand by use to be to fire up reflector, throw your assembly in and poof there was the four part assembly name, but any more finding a really good reflector is much more difficult (and there is a lot of extra clicking involved by using a second program.)
Visual Studio 2010 has a great feature in allowing you to set up single clicks from the menu bar and via hotkeys to external tools…which means a perfect fit for a simple PowerShell command.
- Go to Tools -> External Tools.
- The External Tools dialog box should open for you. Click Add.
- This will then generate a new value labeled [New Tool 1] and have it selected for you.
- In the lower half, provide a Tittle for the new tool such as "4-Part Name".
- In the Command, textbox you will enter the following
- In the Arguments, textbox enter the following
- Select Use Output window to force the assembly name into the output window of Visual Studio.
- The completed dialog should resemble the following
- Click OK.
- Your command should now display under Tools.
- To get the four part name,