Assembly is an important part of any .NET application.Compiling any application builds an assembly.
Following are the main componenets of an assembly:
1 Intermediate language code
3 Assembly Manifest
When we compile any c# program it is compiled to IL or intermediate language contained in an exe or dll.This exe or dll is called an assembly and is understood and executed by CLR. Intermediate language is not the machine language and compiled to machine language when executed. The just in time compiler or JIT actually compiled
this IL to machine language at runtime.This is how machine independence is implemented in .NET.The same assembly can be executed on any machine which supports .NET.
Apart from the intermediate language assembly contains one other important part which is metadata.The c# program which we define contains typed and these types are
converted to IL when program is compiled.Now when CLR is going to execute the code it refers these types from the metadata.
Manifest describes the assembly such as which modules are part of the assembly in case of a multi file assembly.
These can be resources such as an image or a language resource for a specific language.
Other useful concepts reacted to assembly are:
Global assembly cache ,GAC
GAC is just a folder on the machine which contains all the assemblies which should be sahred across the applications.It contains all the common assemblies such as the
.NET framework assemblies.
Private and shared assemblies
There are two types of assemblies depending on if the assembly is shared across applications
Private assemblies These are specific to the application.Each application has its own copy of the private assembly
Shared assembly These are shared by multiple applications.Usually shared assemblies are installed in the GAC.
Strong named assemblies
Strong naming an assembly ensures that the assembly has a unique name.This allows us to install the assemblies in GAC. Also since the strongly named assemblies are digitally signed, this prevents any tampering of the assembly.Any tampering with the assembly invalidates the assembly.So we can be sure that if we are using a strongly named assembly then it has not been tampered with.