Showing posts with label Creating Shared Assembly. Show all posts
Showing posts with label Creating Shared Assembly. Show all posts

Sunday, January 2, 2011

Creating Shared Assembly

To create a shared assembly following steps are required-
Step1 Create a strong name file.
           sn -k strongNameFile.snk
          
A strong name file will created in the  d:\a1dotnetguru\ directory.



Step2 Sign your assembly by that strong name.
           using System;
           using System.Reflection;
          [assembly:AssemblyKeyFile("strongNameFile.snk")]
          namespace myproject
         {
            public class employee
          {
            public string work()
           {
              return "doing work";
          }
   
       }
    }


          Note: Now this assembly will have public key.
Step3 Compile the code into DLL.
          csc /t:library example1.cs

Step4 Register it in GAC
          Gacutil /i example1.dll