- Def: An assembly is the container of compiled code of .NET applications.
- It contains the code in MSIL (Microsoft Intermediate Language) language.
- At run time, it will be compiled by CLR‘s JIT compiler into machine language.
- The assembly file (with .exe or .dll extension) will be generated in the project folder \bin folder, after compilation.
- Executable Assemblies / Process Assemblies / Private Assemblies (with .EXE extension)
a. This is generated with
- Console Applications
- Smart Device Applications
- Windows Applications
- Library Assemblies / Re-usable Assemblies / Shared Assemblies (with .DLL extension)
i. This is generated with
- Class Library
- Windows Forms Control Library
ii. These are non-executable files.
Advantage: The code is this assembly is accessible from other projects.
b. These files are ready for execution. You can execute those by simply double clicking.
Limitation: The code in this assembly is not accessible from other projects.
- A class library project is meant for the development of Shared Assemblies.
- The shared assemblies are re-usable in other applications also.
- That means the class library‘s code is re-usable in other applications, whenever required.
- Class library project contains only user-defined classes.
- Whenever the class library project is compiled, a library assembly file (with .DLLextension) will be generated in the ―bin\Debug folder.
- The class library project can‘t be executed directly unlike console applications, windows applications etc.
All the shared assemblies should be saved in the GAC. GAC offers the following advantages.
- Unique identification of the shared assemblies.
- Avoids the DLL hell (replacement of an assembly related to one application, by another application).
- Faster accessibility.
To view the currently installed assemblies in the GAC, open the following folder C:\windows\assembly The above folder is able to contain multiple dll files with same name, with different versions.
The strong name key is a file, which acts as a unique identifier, for the shared assemblies, stored in the GAC. In other words, GAC recogniz es the assembly with this strong name only.
No comments:
Post a Comment