Blue Theme Orange Theme Green Theme Red Theme
 
Team Foundation Server Hosting
Home | Forums | Videos | Advertise | Certifications | Downloads | Blogs | Interviews | Jobs | Beginners | Training
 | Consulting  
Submit an Article Submit a Blog 
 Jump to
Skip Navigation Links
TechnologyExpand Technology
WebsiteExpand Website
Team Foundation Server Hosting
Search :       Advanced Search »
Home » Windows Forms C# » How to give strong name to DLL and how to install DLL in GAC

How to give strong name to DLL and how to install DLL in GAC

This article tells you how to create strong name for your DLL files and also to install DLL in GAC.

Page Views : 84736
Downloads : 0
Rating :
 Rate it
Level : Intermediate
   Print Read/Post comments Post a comment  Similar Articles  
   Email to a friend  Bookmark  Author's other articles  
 
Team Foundation Server Hosting
Become a Sponsor
Team Foundation Server Hosting
Become a Sponsor
 Tag Cloud
 Latest Jobs
More ... 
 Latest Interview Questions
More ... 

Steps for Giving  strong name to DLL

  1. Open .net command prompt.
  2. Go to the folder contanig DLL.
  3. Type sn -k test.snk, you can use any file name instead of test. This will create  test .snk file in that folder.
  4. Open the assemblyinfo.cs file of project.
  5. Type file path  in this tag [assembly:AssemblyKeyFile@"E:\hemant\practice\HP\bin\Debug\HP.snk")]
  6. Build  application, finally your strong name created for your DLL.

Example

  • Created class library path E:\hemant\practice\HP
  • Open command prompt go to Dll folder path.



  • Type sn -k HP.snk



This create  HP.snk file in E:\hemant\practice\HP\bin\Debug folder.

  • Open the  AssemblyInfo.cs file of project. 

    Type  path  of snk file in following attribue.



  • Build class library.              

Steps for  Installing  in GAC

  • After giving strong name in .net command prompt type gacutil in DLL path



this will install file in assembly.

  • Copy the DLL file C:\WINDOWS\Microsoft.NET\Framework\v1.1.4322 folder.



  • You can add references  to another  project  using .net tab.


  

Comment Request!
Thank you for reading this post. Please post your feedback, question, or comments about this post Here.
Login to add your contents and source code to this article
 [Top] Rate this article
 
 About the author
 
Hemant Patil
Looking for C# Consulting?
C# Consulting is founded in 2002 by the founders of C# Corner. Unlike a traditional consulting company, our consultants are well-known experts in .NET and many of them are MVPs, authors, and trainers. We specialize in Microsoft .NET development and utilize Agile Development and Extreme Programming practices to provide fast pace quick turnaround results. Our software development model is a mix of Agile Development, traditional SDLC, and Waterfall models.
Click here to learn more about C# Consulting.
 
Introducing MaxV - one click. infinite control. Hyper-V Hosting from MaximumASP.
Finally – a virtual platform that delivers next-generation Windows Server 2008 Hyper-V virtualization technology from a managed hosting partner you can truly depend on. Visit www.maximumasp.com/max for a FREE 30 day trial. Hurry offer ends soon. Climb aboard the MaxV platform and take advantage of High Availability, Intelligent Monitoring, Recurrent Backups, and Scalability – with no hassle or hidden fees. As a managed hosting partner focused solely on Microsoft technologies since 2000, MaximumASP is uniquely qualified to provide the superior support that our business is built on. Unparalleled expertise with Microsoft technologies lead to working directly with Microsoft as first to offer IIS 7 and SQL 2008 betas in a hosted environment; partnering in the Go Live Program for Hyper-V; and product co-launches built on WS 2008 with Hyper-V technology.
Dynamic PDF
ceTE software specializes in components for dynamic PDF generation and manipulation. The DynamicPDF™ product line allows you to dynamically generate PDF documents, merge PDF documents and new content to existing PDF documents from within your applications.
Discover the top 5 tips for understanding .NET
Ricky Leeks presents the top 5 tips for understanding .NET Interoperability. Learn more.
Nevron Chart for .NET 2010.1 Now Available
The leading .NET charting control now features PDF, Flash and Silverlight export, visualization of large datasets and more. Deliver true charting functionality to your BI, Scorecard, Presentation or Scientific apps. Download evaluation now.
ASP.NET 4 Hosting
Get 2 Months Free of ASP.NET Hosting for Only $4.95/month! Receive FREE MS SQL and MySQL Databases Including ASP.NET 4/3.5, MVC 3.0, Silverlight 4, Windows 2008/IIS 7.0 Plus FREE IIS 7 Modules. Host UNLIMITED ASP.NET Web Sites – Click Here!
 
 Post a Feedback, Comment, or Question about this article
Subject:
Comment:
Team Foundation Server Hosting
Become a Sponsor
 Comments
Why copying the DLL to the Framework folder? by Jose On December 26, 2008
What if the dll I copy there isn't the same I registered on the GAC? Wouldn't that be a mess? Thanks
Reply | Email | Modify 
Absolute path for assembly key file should not be used by Anders On January 22, 2011
// (*) In order to create a KeyFile, you can use the sn.exe (Strong Name) utility. // When specifying the KeyFile, the location of the KeyFile should be // relative to the project output directory which is // %Project Directory%\obj\<configuration>. For example, if your KeyFile is // located in the project directory, you would specify the AssemblyKeyFile // attribute as [assembly: AssemblyKeyFile("..\\..\\mykey.snk")]
Reply | Email | Modify 
Error while creating strong name file . by Amit On February 17, 2011
HI Hemant, I tried with steps you mentioned above, I got a warning "Use command line option '/keyfile' or appropriate project settings instead of 'AssemblyKeyFile' d:\Creations\MyAPP\MyApp\MyApp\Properties\AssemblyInfo.cs" I completed all steps but my dll is not found in "C:\Windows\Assembly". Please help me on this issue. Thanks. Amit.
Reply | Email | Modify 
regarding Dll and stron name key creation and installation by Sutha On September 8, 2011
You can add references to another project using .net tab. Note: in last fig shows our dll file installed into GAC. but mine installed , but in that tab that file is not showing as like last fig
Reply | Email | Modify 
occured problem while installing in GAC by Gajanan On November 24, 2011
When i tried to install dll in GAC i got some problem , plz help me. The error message is" Failure adding assembly to cache: The system cannot find file specified."
Reply | Email | Modify 
6 Months Free & No Setup Fees ASP.NET Hosting!
 © 2012  contents copyright of their authors. Rest everything copyright Mindcracker. All rights reserved.