70 likes | 248 Views
Global Assembly. Publicly sharing functionality among different applications. Located in Global Assembly Cache. Identified by globally unique name ,culture, version and public key. Digital signature to ensure that it can’t be tampered with. Smaller exe files
E N D
Global Assembly • Publicly sharing functionality among different applications. • Located in Global Assembly Cache. • Identified by globally unique name ,culture, version and public key. • Digital signature to ensure that it can’t be tampered with. • Smaller exe files • Dynamic linking i.e loading on demand
Creating a global assembly 1)create the key pair using strong name tool (sn) - c:\cs> sn –k myKeyPair.snk 2)Create a source file named ga.cs and add the following attributes at the beginning [assembly:AssemblyKeyFile(“myKeyPair.snk")] [assembly:AssemblyVersion("1.0.0.0")] 3) Create a module out of the source file (ga.cs ga.dll) c:\cs> csc /t:module /out:bin\ga.dll ga.cs 4) Create a global assembly named myga.dll from ga.dll using al (assembly linker). c:\cs> al /t:library /out:bin\myga.dll bin\ga.dll [or] c:\cs>al /t:library /keyfile:app.snk /v:1.0.0.0 /out:bin\myga.dll bin\ga.dll If you didn’t add the attributes to the sourfile.
Creating a global assembly 5) Load the global assembly (myga.dll) to GAC (Global Assembly Cache) using ‘gacutil’ C:\cs>gacutil –i bin\myga.dll - i switch installs the assembly into global assembly cache. 6) Check if ur assembly has been installed by using the following command c:\cs>gacutil –l myga