Você está na página 1de 23

Dot Net Technologies

Bibek Kumar
CSE Deptt. DITU
bibek.kumar@dituniversity.edu.in
INDEX
• Introduction to .NET
• .NET Framework.
• Features of .NET framework.
• Component of .NET Framework
• Elements of .NET
• Assembly and its types
• Creating Shared assembly
• Creating DLL Files

Bibek Kumar, Assistant Professor , CSE Deptt., DTU Dehradun


Introduction to .NET
• .NET is the technology from Microsoft on which
all other MS Technologies will be depending in
near future.
• To meet the challenge of next generation of
Internet-Based Computing, Microsoft has come
up with the .NET Platform.
• Java and related tools was growing day by day
and people were shifting towards java and
leaving VB and VC++.
• Microsoft developed .NET to become in the
battle.
Bibek Kumar, Assistant Professor , CSE Deptt., DTU Dehradun
Introduction to .NET
Microsoft .NET is a framework.
Provide common platform to execute or, run
the applications developed in various
programming languages.
Developed by Microsoft.
Announces in July 2000.
The main intention was to bridge the gap in
interoperability between services of various
programming language.
Bibek Kumar, Assistant Professor , CSE Deptt., DTU Dehradun
.NET Platform
 The .NET platform is the set of technologies.
 It simplify software development by building application of XML web
services.
 The .NET platform consists of the following core technologies.
A. The .NET Framework
B. The .NET enterprises services.
C. Building block services.
D. Visual studio .NET

Bibek Kumar, Assistant Professor , CSE Deptt., DTU Dehradun


.NET Framework
 It is a programming infrastructure created by MS for building , deploying
and running applications and services that uses .NET technologies, such
as desktop applications and web services.
 It is a platform for application developers.
 It is a framework that supports multiple language and cross language
integration.
 It has IDE(Integrated development environment)
 It is a set of utilities or can say building blocks for application system.
 .NET provide interoperability between languages ( common type system
or CTS).
 It also includes the .NET common language runtime(CLR) which is
responsible for maintaining the execution of all application developed
using the .NET library

Bibek Kumar, Assistant Professor , CSE Deptt., DTU Dehradun


.NET Framework...

Bibek Kumar, Assistant Professor , CSE Deptt., DTU Dehradun


.NET Framework ..….
.NET Framework Component
1)Common Language run time(CLR).
2)Framework Class library(FCL)=Base Class
Library(BCL).
3) Common Language Specification(CLS).
4) Common type system(CTS).
5) Common intermediate language(CIL).

Bibek Kumar, Assistant Professor , CSE Deptt., DTU Dehradun


Features of .NET
1. Interoperability
2. Language Independence
3. Simplified Deployment & Configuration
4. Security
5. Portability
6. Easy development of web applications
7. OOP Support
8. Multi-Device Support
9. Automatic memory management
10. Strong XML support

Bibek Kumar, Assistant Professor , CSE Deptt., DTU Dehradun


.NET Component

The .net framework is one of


the tool provided by the .NET
infrastructure and tool
component of .NET platform as
shown in figure.

Bibek Kumar, Assistant Professor , CSE Deptt., DTU Dehradun


Elements of .NET Framework
Common Language run time(CLR).
 The CLR called the execution engine for .NET applications and serves as interface
between .NET applications and operating systems.
 CLR is somewhat comparable to java virtual machine (JVM).
 The CLR is platform on which applications are hosted and executed (Code
written in C#, VB etc)
 For intermediate code called MSIL managed by CLR and first CLR converts it into
machine code to be executed by processor.

Bibek Kumar, Assistant Professor , CSE Deptt., DTU Dehradun


Elements of .NET
Common Language run time(CLR).
 The CLR manages memory, thread execution, garbage
collection(GC), exception handling , common type
system(CTS), code safety verification and other services.
 Microsoft intermediate language(MSIL) is a CPU
independent set of instructions that can be efficiently
converted to the native code.
 We can also call it as intermediate language (IL) or common
intermediate language(CIL).
 CLR translates code into MSIL code that can be converted
into CPU specific code with the help of JIT Compiler.

Bibek Kumar, Assistant Professor , CSE Deptt., DTU Dehradun


Elements of .NET
Common Language run time(CLR).

Bibek Kumar, Assistant Professor , CSE Deptt., DTU Dehradun


Elements of .NET
Common Language Specification(CLS)

 It defines a set of rules and restrictions that every language must follow
which runs under .NET framework.
 This is done in such a way, that programs written in any language can
interoperate with other languages.
 This also can take full advantage of inheritance, polymorphism,
exceptions and other features.
Bibek Kumar, Assistant Professor , CSE Deptt., DTU Dehradun
Elements of .NET

Common Type System(CTS)

Bibek Kumar, Assistant Professor , CSE Deptt., DTU Dehradun


Elements of .NET

Base Class Library(BCL)

A .NET Framework library, BCL is the standard for the


C# runtime library and one of the Common Language
Infrastructure (CLI) standard libraries. BCL provides
types representing the built-in CLI data types, basic
file access, collections, custom attributes, formatting,
security attributes, I/O streams, string manipulation,
and more.

Bibek Kumar, Assistant Professor , CSE Deptt., DTU Dehradun


.NET Framework….
.NET Framework Class library(FCL)
 It includes a huge collection of reusable classes , interface,
and value types that easy optimize and integrated with the
CLR.
 It contains more than 7000+ classes and data types to read
and write files access databases, process XML, display a
graphical user interface, draw graphics , create and consume
of web services.
 FCL contains code supporting all the .NET technologies like
windows forms , ASP.NET, ADO.NET, windows workflow,
windows communication foundation etc.

Bibek Kumar, Assistant Professor , CSE Deptt., DTU Dehradun


Elements of .NET
CLR Activities for executing a program

Bibek Kumar, Assistant Professor , CSE Deptt., DTU Dehradun


What is a .Net Assembly?
The .NET assembly is the standard for components developed
with the Microsoft.NET. Dot NET assemblies may or may not be
executable, i.e., they might exist as the executable (.exe) file or
dynamic link library (DLL) file. All the .NET assemblies contain
the definition of types, versioning information for the type,
meta-data, and manifest. The designers of .NET have worked a
lot on the component (assembly) resolution.
There are two kind of assemblies in .NET:
• private
• shared

Bibek Kumar, Assistant Professor , CSE Deptt., DTU Dehradun


How to create shared assembly?
Creating A shared assembly

Step 1: Generate a key file. Open a VS command prompt. Go into your folder and
generate a key file as:
<drive>:\<folder> sn -k key.snk

Step 2: create a project and associate a key file to it before compilation so that the
generated assembly will be strong named.
Open a new project of type class library and name it sAssembly; under class1 write
the following:

Public string sayhello()


{
Return "hello from shared assembly";
}

Bibek Kumar, Assistant Professor , CSE Deptt., DTU Dehradun


How to create shared assembly?
Step 3: copying the assembly into GAC
.Net provides a command line utility to be used as shown in the following:
Gacutil -I | -u <assembly name> I:install u:uninstall
Open a VS command prompt; go to the location where the Assembly.dll is present
and write the following:

<drive>:\<folder>\sAssembly\ sAssembly\\bin\Debug>gacutil -I Assembly.dll

Step 4: Testing
Open a new project add a reference to Assembly.dll and write the following code for
the button click event.

sAssembly.Classs1 obj=new sAssembly.Class1();


Messagebox.Show(obj.sayhello());

Run the project and verify under the bin/debug folder of the current project where
we will not find a copy of the Assembly.dll as it is a shared assembly.
Bibek Kumar, Assistant Professor , CSE Deptt., DTU Dehradun
Create DLL Files
You need to make a class library and not a Console Application. The console
application is translated into an .exe whereas the class library will then be compiled
into a dll which you can reference in your windows project.
• Right click on your Console Application -> Properties -> Change the Output type
to Class Library

Bibek Kumar, Assistant Professor , CSE Deptt., DTU Dehradun


Create DLL Files
• To create a DLL File, click on New project, then select Class Library.
• Enter your code into the class file that was automatically created for you and
then click Build Solution from the Debug menu.
• Now, look in your directory: ../debug/release/YOURDLL.dll
• There DLL file is Created

DLL files cannot be run just like normal application (exe) files. You'll need to create a
separate project (probably a win forms app) and then add your dll file to that project
as a "Reference", you can do this by going to the Solution explorer, right clicking your
project Name and selecting Add Reference then browsing to where ever you saved
your dll file.

Bibek Kumar, Assistant Professor , CSE Deptt., DTU Dehradun

Você também pode gostar