Chapter 1:The .NET Foundation
to the original file. It uses the JIT compiler once again to compile the IL code down to
The JIT compiler, as it compiles to machine code, makes sure that the co de is type safe. It does
this to ensure that objects are separate, thereby making certain that ob jects won t
unintentionally corrupt one another.
In the applications that you build within the .NET Framework, assemblies will always play an
important role. Assemblies can be thought of as the building blocks of y our applications.
Without an associated assembly, code will not be able to compile from IL . When you are using
the JIT compiler to compile your code from managed code to machine code, the JIT compiler
will look for the IL code that is stored in a portable executable (PE) file along with the
associated assembly manifest.
Every time you build a Web Form or Windows Form application in .NET, you are actually
building an assembly. Every one of these applications will contain at le ast one assembly.
As in the Windows DNA world where DLLs and EXEs are the building blocks of applications,
in the .NET world, it is the assembly that is the used as the foundation of applications.
In the world of Windows DNA and COM, there was a situation that was refe rred to as DLL
Hell. COM components were generally designed so that there was only one version of that
COM component on a machine at any given time. This was because the COM s pecification
did not provide for the inclusion of dependency information in a compone nts type definition.
When the developer had to make some changes to the COM component, this n ew component
was introduced and, in many cases, broke applications.
With .NET, it is now possible to have multiple versions of components, o r assemblies, running
on the same server side by side. An application will always look for the assembly that built it.
When an application is started in .NET, the application will look for an assembly in the
installation folder. Assemblies that are stored in a local installation folder are referred to as
private assemblies. If the application cannot find the assembly within the installation fo lder,
the application will turn to the Global Assembly Cache (GAC) for the assembly.
The GAC is a place where you can store assemblies that you want to share across applications.
You can find the assemblies that are stored in the GAC in the WINNT\ASSEMBLY folder in
your local disk drive.
The structure of an assembly
Assemblies contain code that is executed by the Common Language Runtime. The great thing
about assemblies is that they are self-describing. All the details about the assembly are stored
within the assembly itself. In the Windows DNA world, COM stored all its self-describing
data within the server s registry, and so installing (as well as uni nstalling) COM components
meant shutting down IIS. Because .a NET assembly stores this information within itself, it
makes XCOPY functionality possible. Installing an assembly is as simple as copying it, and
there is no need to stop or start IIS while this is going on.