Talk on .NET assemblies


Published on

  • Be the first to comment

No Downloads
Total views
On SlideShare
From Embeds
Number of Embeds
Embeds 0
No embeds

No notes for slide

Talk on .NET assemblies

  1. 1. Bellevue .NET User Group Vidya Vrat Agarwal . | .NET Consultant MCPD, MCTS, MCT, MCSD.NET , MCAD and MCSD Talk on .NET Assemblies
  2. 2. Agenda <ul><li>What is .NET Assembly </li></ul><ul><li>Probing process </li></ul><ul><li>Private assemblies </li></ul><ul><li>Accessing private assembly using .config file </li></ul><ul><li>Shared Assemblies and GAC </li></ul><ul><li>Client Redirection to newly deployed assembly in GAC </li></ul><ul><li>Assembly execution and JIT </li></ul><ul><li>Native Image Generator (Ngen.exe) </li></ul>
  3. 3. What is .NET Assembly <ul><li>An assembly is a compiled .NET dll or exe. </li></ul><ul><li>An assembly in .NET contains Metadata and Manifest </li></ul><ul><li>Metadata is data about data. </li></ul><ul><li>Manifest is data about assembly (version info, dependencies etc) </li></ul><ul><li>ILDasm.exe can show the metadata and Manifest. </li></ul>
  4. 4. Probing process and Private Assembly <ul><li>Probing is the process how .NET look out for an assembly during execution. </li></ul><ul><li>Any assembly which lives in an application folder is known as Private assembly </li></ul><ul><li>If an assembly is not found during the probing process FileNotFoundException exception is thrown. </li></ul>
  5. 5. Demo Probing process with Private Assembly
  6. 6. Accessing private assembly using .config file <ul><li>Define a number of subdirectories to group related content. For example, assume you have an application directory named C:MyApp that contains MyApp.exe. Under this folder might be a subfolder named MyLibraries that contains MyApp.dll </li></ul><ul><li>Regardless of the intended relationship between these two directories, the CLR will not probe the MyLibraries subdirectory unless you supply a configuration file </li></ul>
  7. 7. <ul><li>. Configuration files contain various XML elements that allow you to influence the probing process. </li></ul><ul><li>. Configuration files must have the same name as the launching application and take a *.config file extension, and they must be deployed in the client’s application directory. </li></ul><ul><li>Thus, if you wish to create a configuration file for MyApp.exe, it must be named MyApp.exe.config and located under the C:MyApp directory or where the .exe lives. </li></ul>
  8. 8. Demo Accessing private assembly using .config file
  9. 9. Shared Assemblies and GAC <ul><li>GAC is Global Assembly Cache </li></ul><ul><li>GAC is located at C:WindowsAssembly </li></ul><ul><li>.NET dlls live in GAC and user created </li></ul><ul><li>.dll can also live in GAC and can be referenced as Shared dll by many apps. </li></ul>
  10. 10. Demo Deploy an assembly into GAC & Access an assembly from GAC
  11. 11. Client Redirection to newly deployed assembly in GAC <ul><li>Scenario: Consider you have a ver 1.0 deployed and later you built a new functionality as Ver 2.0, now you need redirect all the clients to the this new version of GAC deployed assembly. </li></ul>
  12. 12. Demo Client Redirection to newly deployed assembly in GAC
  13. 13. Assembly execution and JIT Visual Basic .NET Visual C# Visual C++ .NET .NET Platform Code .NET Framework Class Library XML Web Services ADO.NET Data Types Common Language Runtime Source code compiles as MSIL/IL/CIL Programming Services JIT compiler produces machine language Assembly execution and JIT
  14. 14. Demo Assembly execution and JIT
  15. 15. Native Image Generator (Ngen.exe) <ul><li>Ngen.exe is a tool that improves the performance of managed applications. </li></ul><ul><li>Ngen.exe creates native images, which are files containing compiled processor-specific machine code, and installs them into the native image cache on the local computer. </li></ul><ul><li>The runtime can use native images from the cache instead using the just-in-time (JIT) compiler to compile the original assembly. </li></ul>
  16. 16. Demo <ul><li>Native Image Generator (Ngen.exe) </li></ul>
  17. 17. Questions