Sunteți pe pagina 1din 4

.NET Assembly -----------------Assembly The final output of resources after twice-compilation is known as "Assembly". Categories of Assembly --------------------------A) w.r.

t to Application Access 1. Private Assembly Default Assembly is "Private" [Bin\MyApp.dll] It can be used within the application. Another application cannot use it. 2. Shared Assembly A shared assembly can be used by multiple applications within the server. A shared assembly is registered with GAC[Global Assembly Cache]. All shared assemblies are listed at "WINNT\Assembly" sub-folder. A strong-named private assembly can be made "Shared", using GacUtil.exe tool. B) w.r.t Resource-Creation 1. Static Assembly No resources like image, text, xml, web forms, folder can be created at run-time. No of resources remain static. 2. Dynamic Assembly Run-time creation of resources like image, text, xml, web forms, folder. System.Reflection System.Reflection.Emit C) w.r.t Implementation 1. Single-File Assembly If a single file is used to implement the application at a target folder, the assembly is known as "Single-File" Assembly. .msi - Ms Installer .vsi - Visual Studio Installer setup.exe 2. Multi-File Assembly A set of files are necessary to install the application at a destination folder. VSExp2005.zip ----------------After Unzip, a no. files will be restored in a folder and all the files are necessary at run-time. D) w.r.t Deployment -----------------------1. Satellite Assembly

Easily deployable. XCOPY Visual Studio 2005 create Satellite Assembly 2. Resource - Only Assembly Not-Easily deployable A.aspx A.aspx.cs A.aspx.resx // Resource-File - XML file // Created by Resource-Generator Utility [ResGen.exe] // Contains xml- data about all the resources embedded with the .aspx file. The embedded resources may be images, text or xml file. Used in Visual Studio 2003. Creating a "Shared Assembly" from "Private Assembly" --------------------------------------------------------------Step-I --------Generate Strong-name key pair. Key Pair[B91.snk] - Public Key [Shareable] - Private Key [Non- Shareable] DOS>sn -k c:\B91\B91.snk Step-II [Putting meta-data in .cs file] --------Write the AssemblyInfo.cs with key-pair. And recompile it. using System; using System.Reflection; using System.Runtime.InteropServices; [assembly:AssemblyVersion("1.2.33.44")] [assembly:AssemblyKeyFile("C:/B91/B91.snk")] [assmbly:AssemblyTitle("")] [assmbly:AssemblyVersion("")] [assmbly:AssemblyDescription("")] [assmbly:AssemblyTrademark("")] [assmbly:AssemblyCopyright("")] Major Version Minor Version Build Number Revision Step-III [Create Assembly] -----------i) In Vs 2005 Professional, if "Web Control Library" project [Shift+Ctrl+B]

ii) Compiling in DOS mode, using C# compiler DOS>csc /t:library /out:MyApp.dll *.cs[enter] DOS>csc /t:library /out:C:\B91\Bin\MyApp.dll c:\B91\Controls\*.cs[enter] [Now, the assembly is strong-named] Step-IV --------------Installing with GAC, Global Assembly Cache DOS>gacutil /i c:\B91\Bin\B91.dll[enter] [Now, the assembly is shared] ---------------------------------------------------All Shared Assemblies are listed in a particular folder. [WINNT\Assembly] ----------------------------------------------------Global Assembly -------------------Microsoft provided "Shared Assemblies" at the time of installing .NET framework, are known as "Global Assemblies". mscorlib.dll // Base Assembly of .NET class library

System.dll System.Data.dll - Multiple namespaces System.Data System.Data.Sql System.Data.SqlTypes System.Data.SqlClient System.Data.Common System.Data.Odbc System.Data.OleDb System.Xml System.Data.OracleClient.dll System.Web.dll Physically Available at CLR folder. And they are all shared assemblies, and listed at WINNT\Assembly.

GAC - Global Assembly Cache ["Jack"] ---------------------------------------------.NET Components/ Assembly / COM+ need NOT be registered with Windows Registry System[RegEdit.exe] CLR will automatically detect the version at run it in the present server/system.

To Run the component/ assembly in all applications in the present server, the assembly MUST be installed with Global Assembly Cache[GAC]. GacUtil.exe DOS>gacutil /i c:\B91\Bin\MyApp.dll [enter]

DOS>gacutil /l [enter] -> Listing of all shared assemblies [WIINT\Assembly] Meta - Data -vs- Manifest ----------------------------------Meta - Data --------------Vital information about the application. Product Title Product Name Product Description TradeMark Copyright Culture Assembly Version [must] AssemblyKeyFile [For Strong Naming] etc. All the meta-data should be written in an AssemblyInfo.cs Manifest ------------The manifest is a part of assembly which contain the meta-data taken from AssemblyInfo.cs, after twice-compilation. The manifest can be seen from the Assembly, using ILDASM.exe utility tool. .NET App. Tools ------------------Ildasm.exe[MCL De-Assembler Tool] sn.exe [Strong-Naming Utility Tool] GacUtil.exe [Global Assembly Cache Tool] Inter-operability Tools [ASP - To - ASP.NET Migration] -------------------------AxImp.exe [ActiveX Importer Tool] old.dll [ActiveX component] DOS>aximp old.dll new.dll [enter] TlbImp.exe [Type Library Importer Tool] .vb ----> .tlb [old, VB6] DOS>tlbimp old.tlb new.dll [enter]

S-ar putea să vă placă și