A .NET Assembly (DLL or EXE) consists of the following 4 Parts
- Assembly metadata (Also known as the "Manifest")
- Type metadata
- IL code (the partially compiled code that runs off the CLR)
- Resources
A .NET Assembly reference is said to be fully qualified if all the following 4 parts of the Manifest are specified.
- Assembly Name ( a friendly name)
- Version
- Culture Information
- Public Key Token (in case of a shared assembly). This is actually the developer information.
Steps for creating a Shared (or Public) Assembly
"In order to turn a private assembly into a shared-assembly, it has to be installed on the GAC and only those assemblies can be added to the GAC that have strong names."
- Create a fresh Key Pair File (Public-Private keys) using the Strong Name utility (sn.exe)
- Sign the assembly (to be shared on GAC) with this file and compile the assembly. (once compiled, the assembly will have a "Strong Name". A strongly-named assembly will have a Public Key associated with it that uniquely identifies it on that computer. Since the Public key is 128 byte long ( plus 32 bytes of header information), its 8-byte long hash is used instead to identify an assembly. This 8-byte long hash is called the Public Key Token.
- Only a strongly-named assembly is allowed to be added to the Global Assembly Cashe (GAC). So once we have a strongly-named assembly, we can then use a utility such as gacutil to install the assembly into the GAC.
- Once the assembly is installed in the GAC, it becomes a shared-assembly. This effectively means that we can write other applications that can reference and make use of this shared-assembly without having to maintain a separate local copy in their respective application folders.
Read the following articles for additional information.
Link1
Link2
Link3
No comments:
Post a Comment