views:

67

answers:

3

What is the simplest way to find the Public Key Token of an assembly?

The simplest way i can think of would be a simple right-click, get public key, but this fonctionnality isn't there, maybe there is a VS Extension for that.

I'm using VS2010, if an extension is available

+2  A: 

Open a command prompt and type:

"%ProgramFiles%\Microsoft SDKs\Windows\v6.0A\bin\sn.exe" -T <assemblyname>

or if you have VS 2010

"%ProgramFiles%\Microsoft SDKs\Windows\v7.0A\bin\sn.exe" -T <assemblyname>

You can add this as an external tool in VS, as shown here: http://blogs.msdn.com/b/miah/archive/2008/02/19/visual-studio-tip-get-public-key-token-for-a-stong-named-assembly.aspx

digEmAll
Check my edits ;)
digEmAll
@digEmAll: Yeah i know that, I'm looking for an easier way, preferably without leaving VS
moi_meme
Without better answer I'll accept yours, thx
moi_meme
A: 

If you have included the assembly in your project, you can do :

            var assemblies =
                AppDomain.CurrentDomain.GetAssemblies();


            foreach (var assem in assemblies)
            {
                    Console.WriteLine(assem.FullName);
            }
apoorv020
A: 

1) The command is C:\Program Files\Microsoft SDKs\Windows\v6.0A\bin\sn -T {your.dll}

In the above example, the Microsoft SDK resides in C:\Program Files\Microsoft SDKs\Windows\v6.0A. Your environment may differ.

2) To get the public key token of any of your project, you can add sn.exe as part of your External Tools in Visual Studio. The steps are shown in this Microsoft link: How to: Create a Tool to Get the Public Key of an Assembly

Syd
Yeah i know that, I'm looking for an easier way, preferably without leaving VS
moi_meme