asp net 3.5unleashed

Page 58

referenced assembly’s file that contains the manifest. If the type being accessed is in this file, the CLR performs its internal bookkeeping, allowing the type to be used. If the manifest indicates that the referenced type is in a different file, the CLR attempts to load the necessary file, performs its internal bookkeeping, and allows the type to be accessed. The CLR loads assembly files only when a method referencing a type is called. This means that to run an application, all the files from a referenced assembly do not need to be present.

Adding Assemblies to a Project Using the Visual Studio .NET IDE If you’re using the Visual Studio .NET IDE to build your project, you’ll have to add any assemblies you want to reference to your project. To do so, open the Solution Explorer window, right-click on the project you want to add a reference to, and select the Add Reference menu item. This causes the Add Reference dialog box, shown in Figure 2-2, to appear.

Figure 2-2 : Add Reference dialog box in Visual Studio .NET To have your project reference a managed assembly, select the desired assembly from the list. If the assembly you want isn’t in the list, select the Browse button to navigate to the desired assembly (file containing a manifest) to add the assembly reference. The COM tab on the Add Reference dialog box allows an unmanaged COM server to be accessed from within managed source code. The Projects tab allows the current project to reference an assembly that is created by another project in the same solution. To make your own assemblies appear in the .NET tab’s list, add the following subkey to the registry:

HKEY_LOCAL_MACHINE\SOFTWARE\Microsoft\.NETFramework\ AssemblyFolders\MyLibName MyLibName is a unique name that you create—Visual Studio doesn’t display this name. After creating the subkey, change its default string value so that it refers to a directory path (such as "C:\Program Files\MyLibPath") containing your assembly’s files.

Using the Assembly Linker


Issuu converts static files into: digital portfolios, online yearbooks, online catalogs, digital photo albums and more. Sign up and create your flipbook.