Want to protect your cyber security and still get fast solutions? Ask a secure question today.Go Premium

x
Solved

# How do I find my DLL's PublicKeyToken if the project / assembly was not strongly named?

Posted on 2011-09-12
Medium Priority
564 Views
I'm having trouble with finding the PublicKeyToken of my project, created in VS 2010 ASP .NET 3.5 (C#). I've run some tools to find the publickeytoken but now i find out that the project / assembly was not strongly named. i didn't know i was goin to need to strongly name it. is there a way to strongly name it or is there a way to find the publickeytoken for it. It is causing my web.config to fail / error out.
0
Question by:Michael Sterling
• 2

LVL 75

Accepted Solution

käµfm³d   👽 earned 2000 total points
ID: 36523506
If the assembly is not strongly named, then there is no public key token! You can create a new key file to sign the assembly. This won't be a key file in the sense of one attained from the likes of Verisign, et. al., but it will allow you to strongly name the file. You'll find the option to create a key file on the "Signing" tab of your project's properties:

Once you check the box, you can click the dropdown and there will be an option for "<New...>". If you select this, a new dialog will open which allows you to name the key file. You can optionally specify a password for that file as well:

Once you click "OK", your assembly should be strongly named at that point. You can use the Strong Name utility "sn.exe" to inspect the value of the public key token. Open a VS Command Prompt and enter the following command:

sn.exe -T C:\path\to\your\compiled.dll


The PKT should print to the console window.
untitled2.PNG
0

LVL 1

Author Closing Comment

ID: 36524332
thank you
0

LVL 75

Expert Comment

ID: 36524441
NP. Glad to help  = )
0

## Featured Post

Question has a verified solution.

If you are experiencing a similar issue, please ask a related question

Exception Handling is in the core of any application that is able to dignify its name. In this article, I'll guide you through the process of writing a DRY (Don't Repeat Yourself) Exception Handling mechanism, using Aspect Oriented Programming.
High user turnover can cause old/redundant user data to consume valuable space. UserResourceCleanup was developed to address this by automatically deleting user folders when the user account is deleted.
Integration Management Part 2
Screencast - Getting to Know the Pipeline
###### Suggested Courses
Course of the Month10 days, 12 hours left to enroll