views:

726

answers:

5

How do I find out the fully qualified name of my assembly such as:

MyNamespace.MyAssembly, version=1.0.3300.0, 
Culture=neutral, PublicKeyToken=b77a5c561934e089

I've managed to get my PublicKeyToken using the sn.exe in the SDK, but I'ld like to easily get the full qualified name.

+5  A: 

If you can load the assembly into a .NET application, you can do:

typeof(SomeTypeInTheAssembly).Assembly.FullName

If you cannot then you can use ildasm.exe and it will be in there somewhere:

ildasm.exe MyAssembly.dll /text
Hallgrim
Actually, that gives you the assembly in which SomeTypeInTheAssembly resides, which you may not have at compile time.
Dave Van den Eynde
+1  A: 

If you load the assembly (DLL, EXE, etc.) in Reflector it will tell you the full strong name at the bottom.

Richard Slater
A: 

Couple ways.

In code:

Assembly.FullName e.g.

typeof(Thingy).Assembly.FullName

or, if its an installed assembly, from the GAC using the steps in this post on msdn.

joshua.ewer
+3  A: 

Use Assembly.GetExecutingAssembly() to get the current assembly, use Assembly.GetEntryAssembly() to get the assembly that started it all, or use Assembly.GetCallingAssembly() to get the assembly of the code that called your function (one up in the stack).

Once you have the right assembly, use the FullName property, as indicated in other answers.

Dave Van den Eynde
A: 

First thing that comes to mind: use reflector. It's in the lower pane when you select an assembly in the treeview.

Kurt Schelfthout