.NET OVERVIEW
Dr. C.C. Lee
Rong Li
What is the .NET Framework
The .Net Framework defines an
environment that supports the
development and execution of highly-
distributed, component-based applications.
It enables different computer languages to
work together and provides for security,
program portability, and a common
programming model for the Windows
platform.
The .NET Framework (More)
• the .NET Framework is that it does not employ
virtual machine technology. The software
running on .NET is wholly compiled and runs at
the machine level
• .NET employs a technique of multistage
compilation: an initial compile to a portable
intermediate format and, at runtime, a JIT
compile to the final executable form.
• In this system, all languages have a common
level that they share in their intermediate form.
• The .NET Framework supports cross-
languages
a mixture of modules, written in C#, Visual
Basic, J#, can be used to create a single
application
• The .NET Framework supports cross-
languages
compiled .NET applications run on an
supported platform.
• How to achieve multi-language?
• How to achieve cross-platform?
The .NET Framework Architecture
Other
C# C++ VB JScript
languages
The Common Language Specification
Visual Studio .NET
Web Services User Interface
Data and XML
Base Class Library
The Common Language Runtime (CLR)
Two major components:
• Framework Class Library
• Common Language Runtime
Framework Class Library
The library can be used by any language
that conforms to the Common Language
System (CLS) and gives a .NET
compliance program access to the runtime
environment.
Common Language System (CLS):
CLS provides a series of basic rules that
are required for language integration and
determines the minimum requirements for
being a .NET language. CLS includes a
subset of the Common Type System
(CTS).
Common Type System (CTS):
The CTS defines the rules concerning
data types. All .NET components must
obey. The CTS supports the general
concept of classes, interfaces, delegates,
reference types and value types.
Common Language Runtime (CLR)
The CLR is the environment in which all
programs run in .NET.
In .NET, there is only one runtime, which
is used by all languages, the CLR. It
means components can easily be written
in and used from any language because
all languages represent types and object
in the same way.
The CLR in Detail
The CLR
Base Class Library Support
Thread Support COM Marshaler
Type Checker Exception Manager
Security Engine Debug Engine
IL Code Garbage
Compilers Manager Collector
Class Loader
CLR (continue)
In .NET, programs are not compiled into
executable files, they are compiled into
Intermediate Language (IL) code, which
the CLR then executes. The IL code that
C# produces is identical to other .NET
languages produce.
The IL is saved in a file. To execute a
program, use the Just-In-Time compiler to
recompile the IL to generate machine code.
The CLR Execution Model
Other
C# C++ VB J-Script
Languages
Assembly Base Language to Temporary IL
IL Compilers
IL IL IL
Metadata Class Loader
CLR
ASP.NET
Verifier Route for
scripting
DLL/Legacy/Pre-JIT OptIL MSIL
Native Code EconoJIT JIT
Native Code
Execution and Security
• Intermediate Language (IL)
• Assemblies
• Just-In-Time compiler
Intermediate Language (IL)
• IL is similar to machine instructions, but it
is independent of any particular processor
architecture
• IL is full cross-language compatibility from
the infrastructure layer up
• IL is compiled into native machine code by
JIT compiler
Assemblies (1)
• The .NET component packaging medium.
• Contains IL.
• Include both application files and libraries
• It is fully self-descriptive
Assemblies (2)
Assemblies can be either private or shared.
Private assemblies are used only by the
application that installed them, but shared
assemblies are installed into the Global
Assembly Cache (GAC), a repository
maintained by the framework.
Global Assembly Cache (GAC)
• The GAC serves as home for all shared
components
• All shared components are located in
C:\WINDOWS\assembly
or
C:\WINNT\assembly
Content of GAC directory
JIT Compiler
• Then standard JIT compiler runs on
demand.
• JIT compiler generates native machine
code at run time
Summary
The .NET Framework is:
1. Multi-language
2. Cross-platform
3. Based on the CTS, CLS, FCL, CLR and JIT
technology.
Lecture 2
Installing the .NET Framework
Installing Visual Studio .NET
OS Requirement
For C# stand-alone or C# Windows Forms applications
• Windows NT 4.0 (Service Pack 6a required)
• Windows 2000 or Windows XP Professional
For ASP.NET applications
• Windows 2000 or Windows XP Professional or higher
To install the .NET Framework
• Install Internet Explore (IE) 5.5 or higher
• Install Internet Information Services (IIS)
• Install the .NET Framework
Download software for IE 5.5 or higher
then follow the instruction to install.
Install Internet Information Service
1. Open the Windows
Control Panel and
click the Add or
Remove Programs
icon
2. Click the
Add/Remove
Windows
Components icon.
3. Select Internet
Information Services
from the list of
components
4. click Next
Install the .NET Framework
1. download software
for the .NET
Framework at:
http://msdn.microsoft.com/netframework/tec
hnologyinfo/howtoget/default.aspx
2. Click the link .NET Framework 1.1 SDK
to download the software, then follow
the directions of the setup program.
To Install Visual Studio .NET
Visual Studio .NET is not a free software.
One way to install it is from the Visual
Studio .NET CDs. Follow the instructions
to install it.
C# compiler
The .NET Framework SDK and Visual
Studio .NET include the C# compiler,
csc.exe, and a visual debugger, dbgclr.exe
“HelloWorld”
using System;
class HelloWorld
{
public static void Main()
{
Console.WriteLine(“HelloWorld!”);
}
}
Command-line Compiler
To compile
• csc /target:exe HelloWorld.cs
• csc /t:exe HelloWorld.cs
• csc HelloWorld.cs
To run
• HelloWorld.exe
• HelloWorld
VS .NET--“HelloWorld”
1. Launch VS .NET
2. Click New Project
3. Select Visual C# Projects and Console
Application then enter a name for the
project and specify a directory where to
store the files. click OK
4. The editor opened to HelloWorld project.
Edit the project.
5. Select Debug->Start
Without Debugging
on manubar to
compile and run