Documenti di Didattica
Documenti di Professioni
Documenti di Cultura
NET and C#
<< >>
Session Prerequisites
This is an intro of how .NET executes an app Prereqs:
developer object-based programming experience
Today's objectives
The days of compiling and linking a program to produce a single native executable (.EXE) are coming to an end. While program execution in Windows has long been DLL-based (dynamic linking), with .NET we are moving towards a virtual machine model of execution
Topics:
Managed Execution Component-Based Design Deployment
3
Agenda
Managed Execution Component-Based Design Assembly Resolution Deployment
Managed Execution
Idea:
modern software executes within run-time environment why? portable and safer execution
Your Application
Run-time Environment
Operating System
Hardware
5
Java
Based on run-time environment called JVM
JVM = Java Virtual Machine JCL = Java Class Library
Java Application
JVM
Windows x86
6
JCL
JVM
Mac OS PPC
JVM
Palm OS ARM
JVM
.NET
Based on CLR and FxCL
CLR = Common Language Runtime FxCL = Framework Class Library
.NET Application
Operating System
Hardware
7
.NET Application
CLR Windows x86
8
FxCL
CLR
Implications
Your clients must have the .NET Framework
available via Redistributable .NET Framework (20MB) 3 versions: v1.0 (2002), v1.1 (2003), v2.0 (june 2005?) Windows 2003 ships with v1.1 otherwise correct version must be installed
Design trade-off:
portable safer execution (memory management, security, ) slower?
9
Managed code
C#, VB, J# compilers generate managed code
code that requires CLR to run & manage
10
CIL
CIL = Common Intermediate Language
CIL is the assembly language of the CLR managed code == CIL code
// adds 2 integers together and returns the result public int Add(int x, int y) { return x + y; }
11
Agenda
Managed Execution Component-Based Design Assembly Resolution Deployment
12
object
DB
GUI.exe
13
business.dll
data.dll
.NET is Component-Based
CLR and FxCL are components:
.EXE
.DLL .DLL Process
JIT Compiler
obj code
Core FxCL
(MSCOR LIB.dll)
CLR
(MSCOREE.dll)
14
Underlying OS and HW
Assemblies
.NET components are called assemblies Unit of deployment in .NET
1 assembly = 1 or more compiled source files
code.vb code.vb code.cs
15
.EXE / .DLL
Agenda
Managed Execution Component-Based Design Assembly Resolution Deployment
17
Assembly Resolution
CLR must be able to locate correct assemblies
FxCL assemblies as well as our own assemblies
.EXE
.DLL .DLL Process additional FxCL components (DLLs)
JIT Compiler
obj code
Core FxCL
CLR
18
Resolution Algorithm
1. .NET figures out what version is needed
then .NET searches where configured to else .NET searches directory containing .EXE
4. If not found
20
Observations
Manifest contains reference to assembly
name, version #, hash of public key token, etc.
21
22
Agenda
Managed Execution Component-Based Design Assembly Resolution Deployment
23
24