Successfully reported this slideshow.
We use your LinkedIn profile and activity data to personalize ads and to show you more relevant ads. You can change your ad preferences anytime.
Assemblies in .Net                     1
What is an Assembly• When create a project in Visual Studio .Net and  compile it, assemblies are created.     - .DLL     -...
• When compile a program, the compiler translates  the source code into the Intermediate Language  code (IL).• In addition...
• In any Project folder, In bin folder that contains,  say myproject.dll/ myproject.exe and  myproject.pdb files.• The myp...
Structure of Assemblies• An assembly also contains an assembly manifest that  contains the assembly metadata.• This metada...
Process assemblies (EXE) and library assemblies (DLL)• A process assembly represents a process which uses  classes defined...
Feature of Assemblies• Assemblies are self describing• Assembly can be load side by side• Assembly can be private or share...
Why use Assemblies?• The goal of the assembly model is the elimination of  DLL Hell. Under the current model.• A catalog o...
Types of Assemblies• Assemblies can be private or shared.• The assembly which is used by a single  application is called a...
Shared assemblies• Suppose we are creating a general purpose DLL  which provides functionality to be used by a variety  of...
Benefits of Private Assemblies• Private assemblies are installed in a directory  named bin located under the application  ...
Disadvantages:• When you have multiple applications using  one assembly, you have to deploy the  assembly to the bin direc...
How to create an Assembly• A shared assembly can be created in Visual  Studio.Net by a Pair of tool.      - SN.exe utility...
Calculator.cs                            MathProgram.cs                                         using System;namespace cal...
What is Global Assembly Cache?• An assembly that is shared by multiple applications is  called a global assembly and is in...
Add an External Tool• Visual Studio provides the functionality to  include external tools in the Tools menu.• To modify th...
What is ILDASM ?• It is Intermediate Language Dissembler SDK  Tool that is used to examine MSIL code and  the parts of the...
How to Add an External Tool                              18
Click on add button and spedify name ILDASM.                                               19
20
View the content of an Assembly  Click on File menu and Then Open a File                                            21
Select an Assembly File and Open                                   22
Double Click on Manifest                           23
Double Click on mycalc                         24
• End of Presentation.• Thank’s for Watching.JANAS KHAN                          25
Upcoming SlideShare
Loading in …5
×

Assemblies

2,996 views

Published on

A Great Presentation of Assemblies in .NET Technology.

Published in: Technology, Spiritual
  • Be the first to comment

Assemblies

  1. 1. Assemblies in .Net 1
  2. 2. What is an Assembly• When create a project in Visual Studio .Net and compile it, assemblies are created. - .DLL - .EXE• These assemblies are the fundamental units of applications in the .NET Framework.• An assembly contains one or more compiled classes. 2
  3. 3. • When compile a program, the compiler translates the source code into the Intermediate Language code (IL).• In addition to translating the code into IL, the compiler also produces metadata about the program during the process of the compilation.• The IL and the metadata are linked in an assembly.• An IL and metadata exist in portable executable file(EXE/DLL). 3
  4. 4. • In any Project folder, In bin folder that contains, say myproject.dll/ myproject.exe and myproject.pdb files.• The myproject.dll/ myproject.exe is the assembly, and myproject.pdb ( program database ) file contains debugging information for the assembly. 4
  5. 5. Structure of Assemblies• An assembly also contains an assembly manifest that contains the assembly metadata.• This metadata contains information about the classes, methods and properties and so on• This information is stored within the assembly file (DLL/EXE) itself.• Resources are non executable data that is a part of Application. e.g: images, sound and video etc. 5
  6. 6. Process assemblies (EXE) and library assemblies (DLL)• A process assembly represents a process which uses classes defined in library assemblies 6
  7. 7. Feature of Assemblies• Assemblies are self describing• Assembly can be load side by side• Assembly can be private or shared 7
  8. 8. Why use Assemblies?• The goal of the assembly model is the elimination of DLL Hell. Under the current model.• A catalog of DLLs is centralized in the Windows Registry.• When a new version of a DLL is published, the registry re-references the catalog to point to the new DLL. 8
  9. 9. Types of Assemblies• Assemblies can be private or shared.• The assembly which is used by a single application is called as private assembly.• Suppose we have created a DLL which encapsulates business logic. This DLL is used by the client application only and not by any other application. 9
  10. 10. Shared assemblies• Suppose we are creating a general purpose DLL which provides functionality to be used by a variety of applications. Now, instead of each client application having its own copy of DLL we can place the DLL in global assembly cache. Such assemblies are called as shared assemblies. 10
  11. 11. Benefits of Private Assemblies• Private assemblies are installed in a directory named bin located under the application directory. These files are private to the application.• It is great for small utility Assemblies/ application specific code 11
  12. 12. Disadvantages:• When you have multiple applications using one assembly, you have to deploy the assembly to the bin directory of each application. 12
  13. 13. How to create an Assembly• A shared assembly can be created in Visual Studio.Net by a Pair of tool. - SN.exe utility. - Gacutil tool• The sn.exe utility is located in the Bin directory.• After creating the shared assembly we should sign the shared assembly to the GAC by using Gacutil tool. 13
  14. 14. Calculator.cs MathProgram.cs using System;namespace calculate using calculate;{ public class mathoperation class mycalc { { public int subtraction(int a, int static void Main() b) { { mathoperation c1 = new mathoperation(); return a-b; int result = c1.subtraction(50,20); Console.WriteLine("The result is:{0}",result); } Console.Read(); } } }}c:>csc /t:library Calculator.cs c:>csc /t: /r:Calculator.dll MathProgram.csCreated DLL file “Calculator.dll” Created EXE file “MathProgram.exe” 14
  15. 15. What is Global Assembly Cache?• An assembly that is shared by multiple applications is called a global assembly and is installed in the global assembly cache (GAC).• Global assembly cache is nothing but a special disk folder where all the shared assemblies are kept.• It is located under <drive>:WindowsAssembly folder on every machine running the .NET framework. 15
  16. 16. Add an External Tool• Visual Studio provides the functionality to include external tools in the Tools menu.• To modify the existing tools or to add new tools of your own, you simply need to go to Tools → External Tools. 16
  17. 17. What is ILDASM ?• It is Intermediate Language Dissembler SDK Tool that is used to examine MSIL code and the parts of the Assembly.• It comes with the installation of Visual Studio IDE. 17
  18. 18. How to Add an External Tool 18
  19. 19. Click on add button and spedify name ILDASM. 19
  20. 20. 20
  21. 21. View the content of an Assembly Click on File menu and Then Open a File 21
  22. 22. Select an Assembly File and Open 22
  23. 23. Double Click on Manifest 23
  24. 24. Double Click on mycalc 24
  25. 25. • End of Presentation.• Thank’s for Watching.JANAS KHAN 25

×