Sei sulla pagina 1di 5

Difference between Pre Dot net and Dot net Framework

Compile a dot net Application Intermediate language is generated


Common language Runtime (CLR) has JIT Compiler converts IL into native code
CLR Provides Portability and Memory Management and Garbage Collection
IL (Managed Code) - .DLL or .EXE
Depending on the type of application .DLL or .EXE will be generated
Windows Based application - .Exe
Web based application - .Dll

Dot net Execution 2 Steps


Code ---- IL ----- Native Code
C++ can generate Managed or unmanaged(Native) code
Native code will be in memory only during the lifetime of execution and it gets
deleted once we close the application.

ILDASM or ILASM:

To view the intermediate language we can use Intermediate language


disassembler(ILDASM) which disassembles the packed assembly which is generated
once we compile the application.
To go to ILDASM , go to All Programs --- Microsoft Visual Studio 2010 ---- Visual
Studio Tools Run as Administrator type ILDASM.exe then type the path ( go to
the path where the assembly is being stored )
Any assembly will contain2 parts Manifest and IL
Intermediate language has the program stored in memory addresses
Manifest contains the information about the related assemblies and their versions.
In ILDASM window Click file dump and save as text file where IL will be saved in text
format.
We can convert the text file into assmebly by using ILASM in Visual command
Prompt

Strong naming the assembly


.Net framework assemblies reside in GAC (Global Assembly Cache) which contains
the .Net framework Class libraries. The path of GAC is C:\Windows\Assembly
Weak named assemblies
Strong named assemblies
All strong named assemblies will have the public key token which can be seen in
GAC
To set the assembly as strong named assembly go to Visual studio Prompt , then
type sn.exe k C:\MyStrongKeys.snk
Snk.exe will generate a Key pair and write it on the file MyStrongKeys.snk
We have to change the attribute of the assembly by Pasting the above file path in
the AssemblyInfo.cs
As [assembly.assemblykeyfile(C:\\MyStrongKeys.snk)] and then build the solution
then it will become a strong named assembly
Four parts of the assembly are
1.
2.
3.
4.

Simple textual name


Version number
Culture
Public token key

Strong named assemblies are uniquely named.


GAC
We have to move our assemblies to GAC only when it is shared among multiple
projects in the same machine.
If we copy our project to another machine then it is not advisable to move the
assembly to GAC as the copied folder will have only the application files and not the
GAC content and hence the associated assemblies will be missing.
The path of the GAC is C:\Windows\assembly for .Net 2.0 to .Net 3.5
The path of the GAC is C:\Windows\Microsoft .Net\assembly for .Net 4.0

To install an assembly into GAC:


Simply drag and drop or use GACutil.exe
Go to Visual studio prompt go to the path of the folder where the assembly is
located
By typing cd <Path of the assembly>
Then type gacutil i <name of the assembly>
Eg: gacutil i Classlibrary.dll
For Uninstalling : use gacutil u <name of the assembly>
Eg: gacutil u Classlibrary

Assemblies with different versions will be copied seperately in GAC with the same
name and this is called side by side execution as they can be executed in parallel.
To uninstall a specific version of the assembly we have to mention the version as
well
Gacutil u classlibrary,version=1.0.0.0,Publickeytoken=eeaabf36d7783129

How CLR finds the path of the assembly during run time:
CLR first checks the GAC if it is a Strong named assembly
Then it will check the .Config file or
It will check the bin folder of the executable

DLL Hell:
If there are 2 applications that share the same assembly and when one of the
application is changed then the other application throws error if the method used by
the first application is missing .

Solving DLL Hell Problem:


To Avoid this problem first make the shared assembly as a strong named assembly
and then install that in a cache.

Potrebbero piacerti anche