Get the PublicKeyToken of an assembly

crickpaolo
crickpaolo used Ask the Experts™
on
I have an ASP.NET web application that uses a bunch of assemblies.  They are all declared under the <assemblies> tag on web.config. I have a couple of questions regarding this:

1. How do I get the PublickKeyToken for a particular .dll?
2. If the assembly is declared in the web.config, does that always mean that it is located on the GAC?

Many thanks.
Comment
Watch Question

Do more with

Expert Office
EXPERT OFFICE® is a registered trademark of EXPERTS EXCHANGE®

Commented:
Not sure what you are trying to accomplsih.

Have you checked the following method?

System.AppDomain.CurrentDomain.GetAssemblies()

Author

Commented:
Here's my situation:

I inherited an ASP.NET application (written in 2005) that uses several assemblies. One of the assemblies, for example, is declared on web.config as:

<add assembly="eWorld.UI, Version=1.9.0.0, Culture=neutral, PublicKeyToken=24X65337282035F2"/>

I didn't know what this assembly was, so I googled it, and it turned out to be a third party dll for creating calendar popups. I downloaded the assembly, but I can only download the latest version which is Version 2.0.0.0.

I changed the Version parameter on web.config, but I think I have to change the PublicKeyToken also, since it is a new version.

Thanks.
                  

Commented:
Try the following commandline:

1) sn -T eWorld.dll
2) No - not necessarily
Exploring ASP.NET Core: Fundamentals

Learn to build web apps and services, IoT apps, and mobile backends by covering the fundamentals of ASP.NET Core and  exploring the core foundations for app libraries.

Author

Commented:
I tried it on on the command line and I get this error:

'sn' is not recognized as an internal or external command,operable proggram or batch file.

do i need to go to a particular directory to run this command?
Commented:
C:\Program Files\Microsoft Visual Studio 8\SDK\v2.0\Bin\sn -T eWorld.dll

Commented:
If needed you should add quotes around the location of sn.

Author

Commented:
It worked! Thanks!

Do more with

Expert Office
Submit tech questions to Ask the Experts™ at any time to receive solutions, advice, and new ideas from leading industry professionals.

Start 7-Day Free Trial