Click here to Skip to main content
14,639,480 members
Articles » Web Development » ASP.NET » General
Tip/Trick
Posted 7 Mar 2012

Stats

192.4K views
18 bookmarked

Referenced assembly does not have a strong name

Rate this:
4.95 (28 votes)
Please Sign up or sign in to vote.
4.95 (28 votes)
7 Mar 2012CPOL
How to give a strong name to your assembly

Introduction

Sometimes you got an error like following when you reference 3rd party dlls.

Assembly generation failed -- Referenced assembly 'Test' does not have a strong name
Cause is An assembly is not signed with a strong name, the strong name could not be verified, or the strong name would not be valid without the current registry settings of the compute.

The strong name protects clients from unknowingly loading an assembly that has been tampered with. Assemblies without strong names should not be deployed outside of very limited scenarios.

An assembly without a strong name  cannot be loaded into the global assembly cache.

To Fix this, have to follow below steps.

Steps to create strong named assembly

Step 1 : Run visual studio command prompt and go to directory where your DLL located.

  For Example my DLL located in D:/hiren/Test.dll

Step 2 : Now create il file using below command.

  D:/hiren> ildasm /all /out=Test.il Test.dll
  (this command generate code library)

Step 3 : Generate new Key for sign your project.

  D:/hiren> sn -k mykey.snk

Step 4 : Now sign your library using ilasm command.

  D:/hiren> ilasm /dll /key=mykey.snk Test.il

so after this step your assembly contains strong name and signed.

Jjust add reference this new assembly in your project and compile project its running now.

License

This article, along with any associated source code and files, is licensed under The Code Project Open License (CPOL)

Share

About the Author

Hiren Khirsaria
Team Leader Reputed IT Company
India India
Having 9+ years of experience in Microsoft.Net Technology.
Experience in developing applications on Microsoft .NET Platform ( Asp.Net, WPF, Silverlight, Windows Phone 7/8).
Experience and knowledge of software design methodologies (Agile), object oriented design, and software design patterns (MVVM).
Experience in Developing android mobile application using Xamarin (mono for android) framework.

http://hirenkhirsaria.blogspot.com/

Comments and Discussions

 
QuestionThis is the steps that working for me Pin
Ejrr10852-Mar-20 15:46
MemberEjrr10852-Mar-20 15:46 
PraiseThank you! This solved my problem Pin
Member 142082871-Apr-19 10:49
MemberMember 142082871-Apr-19 10:49 
QuestionFor nested dependency how to resolve the issue Pin
Member 1285588825-Oct-17 4:22
MemberMember 1285588825-Oct-17 4:22 
PraiseThank you! Pin
mnguyen8819-Apr-16 6:57
professionalmnguyen8819-Apr-16 6:57 
GeneralRe: Thank you! Pin
Hiren Khirsaria19-Apr-16 18:38
professionalHiren Khirsaria19-Apr-16 18:38 
QuestionTHANKS Pin
Vasily Tserekh27-Oct-15 7:19
MemberVasily Tserekh27-Oct-15 7:19 
QuestionAssembly Generation Failed Pin
MSingh2431-Jul-15 21:20
professionalMSingh2431-Jul-15 21:20 
QuestionHow to create a strong-named assembly? Pin
andyadams215-Feb-15 16:28
Memberandyadams215-Feb-15 16:28 
SuggestionAutomated GUI Tool was created using this technique Pin
Nikita Mazhara3-Nov-14 23:28
MemberNikita Mazhara3-Nov-14 23:28 
GeneralThanks man Pin
Member 768851113-Jul-14 20:24
MemberMember 768851113-Jul-14 20:24 
QuestionHi Pin
hasan jamal siddiqui15-Jun-14 2:13
Memberhasan jamal siddiqui15-Jun-14 2:13 
QuestionVersion of ildasm needs to match version of assembly when adding strong name Pin
Member 25245274-Jun-14 14:53
MemberMember 25245274-Jun-14 14:53 
Question3rd party .dll does not have snk Pin
Admin .25-May-14 19:17
MemberAdmin .25-May-14 19:17 
QuestionWhat if I Recompile? Pin
Joe Sweeney10-Jan-14 8:15
MemberJoe Sweeney10-Jan-14 8:15 
AnswerRe: What if I Recompile? Pin
Hiren Khirsaria13-Jan-14 4:45
professionalHiren Khirsaria13-Jan-14 4:45 
AnswerThanks I got my answer. Pin
krunal298416-May-13 2:34
Memberkrunal298416-May-13 2:34 
QuestionError in the last sentence Pin
d.chang30-Apr-13 5:20
Memberd.chang30-Apr-13 5:20 
AnswerRe: Error in the last sentence Pin
Hiren Khirsaria30-Apr-13 19:22
professionalHiren Khirsaria30-Apr-13 19:22 
QuestionAnother way Pin
gbsistemas19-Aug-12 7:44
Membergbsistemas19-Aug-12 7:44 
AnswerRe: Another way Pin
Hiren Khirsaria19-Aug-12 22:07
professionalHiren Khirsaria19-Aug-12 22:07 
QuestionThoughts Pin
PIEBALDconsult7-Mar-12 7:57
professionalPIEBALDconsult7-Mar-12 7:57 
AnswerRe: Thoughts Pin
Hiren Khirsaria9-Mar-12 0:36
professionalHiren Khirsaria9-Mar-12 0:36 
GeneralRe: Thoughts Pin
PIEBALDconsult9-Mar-12 2:18
professionalPIEBALDconsult9-Mar-12 2:18 

General General    News News    Suggestion Suggestion    Question Question    Bug Bug    Answer Answer    Joke Joke    Praise Praise    Rant Rant    Admin Admin   

Use Ctrl+Left/Right to switch messages, Ctrl+Up/Down to switch threads, Ctrl+Shift+Left/Right to switch pages.