Developing with the .Net Framework quite often we have to sign our assemblies and sometimes it could be nice also to know the Public Key Token from our own signed assembly.
To do that we have to use the “sn.exe” utility, provided with the .Net Framework and located usually in “the C:Program FilesMicrosoft SDKsWindowsvX.XXBin" folder. The problem is that we have to use the command prompt (the one provided with Visual Studio not the normal one), add some parameters to the command line and this is, I know, something that a lot of people won’t really like it (me too actually). It’s not our fault, but Visual Studio really spoiled us so why don’t try to find another way to read the Public Key Token of a signed assembly from inside the IDE?
Not so a big deal. A couple of step and we can do it. I think all the developers used at least once the “Tools” menu’ inside Visual Studio. Quite close to the bottom of this menu’ list, there is a link that allow us to customize the tools listed in our own menu’: the “External Tools…” one.
Clicking on this Visual Studio will open a new window like the one showed in the following picture and it will allow us to enter our data to set up the new link that we want to add to menu:
As shown in the picture, the more important data are the arguments:
- -T: ask the sn utility to actually display the token
- $(TargetDir)$(TargetName)$(TargetExt): the Visual Studio variables that will point to our project output
- enable the check “Use Output window” to enable Visual Studio to show the output result from the command in the output window
And we done it!
Now we can develop our own signed assemblies and we could expect a result like this after invoking our new link: