Tuesday, October 20, 2015

GAC - Global Assembly Cache

GAC - Global Assembly Cache

This is a central repository for assemblies in computer. Only strong named assemblies can be registered in GAC.
Location of GAC in any computer is C:\Windows\assembly\
Command to register
gacutil -i assemblyname.dll

Use & advantages of GAC:

  1. Multiple applications can refer same assembly from GAC
  2. GAC can maintain multiple versions of a assembly, so different assemblies can refer their required versions
    Example :
    Our exe is required Myassembly.dll version 1.0.0. Now there is new version available of Myassembly.dll that is 2.0.0 in GAC. We can place a config file with exe mapping old dll to new dll, to  call new dll in exe.
    <bindingredirect oldversion="1.0.0" newversion = "2.0.0" />
  3. Assemblies are secured with windows security, any user of system required admin rights to update or delete assembly 

Strong Name: Strong name contains name, version & public, private or both token keys. A signed assembly is called Strong named assembly

Weak Name: Weak Name does't have public or private key token

Delay Singing: Whenever we sign a assembly there is a option 'Delay Sign Only', if that is chosen later we can again assign a new key file (.snk file) to the assembly
Use of Delay signing : Many times you required strong named assembly in development, so you can sign assembly with public key with delay singing and provide to developers.
At the time deployment on production you can re - assign new key.

No comments:

Post a Comment

CI/CD - Safe DB Changes/Migrations

Safe DB Migrations means updating your database schema without breaking the running application and without downtime . In real systems (A...