Introduction:
I will explain here what assembly, type of assembly and those operations.
Explanation:
What is an assembly?
•An Assembly is a logical unit of code
•Assembly physically exist as DLLs or EXEs
•One assembly can contain one or more files
•The constituent files can include any file types like image files, text files etc. along with DLLs or EXEs
•When you compile your source code by default the exe/dll generated is actually an assembly
•Unless your code is bundled as assembly it can not be used in any other application
•When you talk about version of a component you are actually talking about version of the assembly to which the component belongs.
•Every assembly file contains information about itself. This information is called as Assembly Manifest.
I will explain here what assembly, type of assembly and those operations.
Explanation:
What is an assembly?
•An Assembly is a logical unit of code
•Assembly physically exist as DLLs or EXEs
•One assembly can contain one or more files
•The constituent files can include any file types like image files, text files etc. along with DLLs or EXEs
•When you compile your source code by default the exe/dll generated is actually an assembly
•Unless your code is bundled as assembly it can not be used in any other application
•When you talk about version of a component you are actually talking about version of the assembly to which the component belongs.
•Every assembly file contains information about itself. This information is called as Assembly Manifest.
What is
assembly manifest?
•Assembly manifest is a data structure which stores information about an assembly
•This information is stored within the assembly file(DLL/EXE) itself
•The information includes version information, list of constituent files etc.
Type of assembly
•Assembly manifest is a data structure which stores information about an assembly
•This information is stored within the assembly file(DLL/EXE) itself
•The information includes version information, list of constituent files etc.
Type of assembly
- Private assembly
- Shared assembly
What is
private and shared assembly?
The assembly which is used only by a single application is called as private assembly. Suppose you created a DLL which encapsulates your business logic. This DLL will be used by your client application only and not by any other application. In order to run the application properly your DLL must reside in the same folder in which the client application is installed. Thus the assembly is private to your application.
Suppose that you are creating a general purpose DLL which provides functionality which will be used by variety of applications. Now, instead of each client application having its own copy of DLL you can place the DLL in 'global assembly cache'. Such assemblies are called as shared assemblies.
What is Global Assembly Cache?
Global assembly cache is nothing but a special disk folder where all the shared assemblies will be kept. It is located under <drive>:\WinNT\Assembly folder.
How assemblies avoid DLL Hell?
As stated earlier most of the assemblies are private. Hence each client application refers assemblies from its own installation folder. So, even though there are multiple versions of same assembly they will not conflict with each other. Consider following example :
•You created assembly Assembly1
•You also created a client application which uses Assembly1 say Client1
•You installed the client in C:\MyApp1 and also placed Assembly1 in this folder
•After some days you changed Assembly1
•You now created another application Client2 which uses this changed Assembly1
The assembly which is used only by a single application is called as private assembly. Suppose you created a DLL which encapsulates your business logic. This DLL will be used by your client application only and not by any other application. In order to run the application properly your DLL must reside in the same folder in which the client application is installed. Thus the assembly is private to your application.
Suppose that you are creating a general purpose DLL which provides functionality which will be used by variety of applications. Now, instead of each client application having its own copy of DLL you can place the DLL in 'global assembly cache'. Such assemblies are called as shared assemblies.
What is Global Assembly Cache?
Global assembly cache is nothing but a special disk folder where all the shared assemblies will be kept. It is located under <drive>:\WinNT\Assembly folder.
How assemblies avoid DLL Hell?
As stated earlier most of the assemblies are private. Hence each client application refers assemblies from its own installation folder. So, even though there are multiple versions of same assembly they will not conflict with each other. Consider following example :
•You created assembly Assembly1
•You also created a client application which uses Assembly1 say Client1
•You installed the client in C:\MyApp1 and also placed Assembly1 in this folder
•After some days you changed Assembly1
•You now created another application Client2 which uses this changed Assembly1
•You installed Client2 in
C:\MyApp2 and also placed changed Assembly1 in this folder
•Since both the clients are
referring to their own versions of Assembly1 everything goes on smoothly
Now consider the case when you develop assembly that is shared one. In this case it is important to know how assemblies are versioned. All assemblies has a version number in the form:
major.minor.build.revision
If you change the original assembly the changed version will be considered compatible with existing one if the major and minor versions of both the assemblies match.
When the client application requests assembly the requested version number is matched against available versions and the version matching major and minor version numbers and having most latest build and revision number are supplied.
Now consider the case when you develop assembly that is shared one. In this case it is important to know how assemblies are versioned. All assemblies has a version number in the form:
major.minor.build.revision
If you change the original assembly the changed version will be considered compatible with existing one if the major and minor versions of both the assemblies match.
When the client application requests assembly the requested version number is matched against available versions and the version matching major and minor version numbers and having most latest build and revision number are supplied.
No comments:
Post a Comment