Assembly in Dot Net C#
Assembly
--------------------
Assembly is the final output after
twice-compilation of all C# codes.
--------------------
Assembly is the final output after
twice-compilation of all C# codes.
W.r.t Program Access, assemlies can be
classified into 2 - types.
classified into 2 - types.
• Private Assembly
• Shared Assembly.
• Shared Assembly.
Private Assembly
---------------------
The default assembly created is 'private assembly'.
---------------------
The default assembly created is 'private assembly'.
A private assembly is limited to one application only.
The private assembly should be kept at \Bin folder
of an ASP.NET application.
The private assembly should be kept at \Bin folder
of an ASP.NET application.
Shared Assembly
---------------------
A shared Assembly is usable by all applications
within the system.
---------------------
A shared Assembly is usable by all applications
within the system.
All shared assemblies are LISTED in GAC ['Jack']
- Global Assembly Cache
- Global Assembly Cache
GAC Folder is:
C:\Windows\assembly\
C:\Windows\assembly\
A 'private assembly' can be made 'shared assembly'.
How To Make a Private Assembly - Shared
-----------------------------------------------------
Only a 'Strong Named Private Assembly' can be made 'shared'.
-----------------------------------------------------
Only a 'Strong Named Private Assembly' can be made 'shared'.
--------
Step - 1
------------
Generate 'Strong Name' Key Pair
sn.exe [Strong Naming Utility Tool]
dos>sn -k APPLICATION_PATH\ABC.snk
------------
Generate 'Strong Name' Key Pair
sn.exe [Strong Naming Utility Tool]
dos>sn -k APPLICATION_PATH\ABC.snk
Key Pair
- Private Key [Non-shareable]
- Public Key [Shareable]
- Private Key [Non-shareable]
- Public Key [Shareable]
Step - II
-------------
Add the 'Strong Name Key' as META DATA in
AssemblyInfo.cs File.
-------------
Add the 'Strong Name Key' as META DATA in
AssemblyInfo.cs File.
[assembly:AssemblyKeyFile("APPLICATION_PATH\\ABC.snk")]
Step - III
-------------
Re-Build again to get a 'Strong Named Private Assembly'
-------------
Re-Build again to get a 'Strong Named Private Assembly'
Step - IV
--------------
Install with GAC
GacUtil.exe
dos>gacutil /i APPLICATION_PATH\WebAppABC.dll
Now the assembly is LISTED at C:\Windows\assembly folder.
dos>gacutil /l - for listing in DOS mode
====
Meta Data and Manifest
------------------------------
Meta Data is vital information of an assembly.
Version Number
Strong Naming Key
Strong Naming Key
Company Name
Product Name
Title
Product Name
Title
Copyright
Trademark
Trademark
All meta data should be written in AssemblyInfo.cs.
After compilation, all Meta Data of AssemblyInfo.cs
will be writen into Assembly.
will be writen into Assembly.
All meta data will be available in Manifest of the assembly.
The Manifest can be viewed by ILDASM.exe.
Comments
Post a Comment