Tutorials
VB.NET 2005Single-file and multi-file assemblies, Combining modules written in different languages, Creating a multi-file assembly, End Namespace, Static and dynamic assemblies, Private and shared assemblies, Sharing an assembly, Satellite and Resource-only assemblies, Compiling Satellite Assemblies, Compiling Satellite Assemblies With Strong Names, Obtaining the Public Key, Delay Signing an Assembly, Re-signing an Assembly, Installing a Satellite Assembly in the Global Assembly Cache, Resources in Applications, Creating and Localizing Resources and Packaging and Deploying Resources
A single-file assembly is the simplest of all the assemblies. It contains type information and implementation along with the manifest. This can be created using command-line compilers or Visual Studio 2005. The default file extension for the assembly is .exe. We shallsee how a single-file assembly is created.
Go to the command prompt for Visual Studio.
Type the
The compiler name depends on the language used in code module and the module name is the module that you want to compile into an assembly.
Visual Basic compiler command to compile MyModule.vb is : vbc MyModule.vb C# compiler command to compile MyModule.cs is: csc MyModule.cs
You can use the option /t:library to create a library assembly.
Multi-file assemblies can be created using command line compilers or Visual Studio 2005 with Managed Extensions for C++. This requires that one file should contain the assembly manifest. The assembly that starts an application must also contain an entry point, such as a Main or WinMain method.
Let us now illustrate this point.. Consider an application that you need to compile which contains two code modules namely Personnel.vb and admin.vb. In this, the module admin.vb creates the InAdmin namespace that is referenced by the code in personnel.vb. The personnel.vb contains the main method, which is the application entry point. In this scenario you will compile the two code modules, and then create a third file that contains the assembly manifest, which is used to launch the application. The assembly manifest references both personnel and admin module. Thus the point to be noted is that the multi-file assembly must contain only one entry point. We shall briefly see some of the reasons why we need to create multi-file assembly:
To manage the availability of the assemblies over the network, only the most used modules are downloaded and the least used module is downloaded only when needed.
To combine the modules developed by multiple programmers:
1. The user has the choice to sign the file that contains the assembly manifest or the choice to give the file a strong name and put it in the global assembly cache.
The first step is to compile all the files that contain namespaces referenced by other modules in the assembly into code modules. The default extension for code module is .netmodule. Next compile all other modules using the necessary compiler options to indicate the other modules that are referenced in the code.
Then, use the assembly linker ( Al.exe) to create the output file that contains the assembly manifest. This file contains reference information for all modules or resources that are part of the assembly. Finally, in a new windows project add the following codes to the Form:
Save and build the application. Now use the command vbc with the option/t:module to compile the code. The command prompt window is shown below. The Form1.netmodule file is also displayed here.

Specifying the module parameter with the /t: compiler option indicates that the file should be compiled as a module rather than as an assembly.
Specify the /t:module option because this module will be added to an assembly in a future step. Specify the /addmodule option because the code in Client references a namespace created by the code in Admin.netmodule. The compiler produces a module called personnel.netmodule that contains a reference to another module, admin.netmodule.
The Visual Basic compilers support directly creating multi-file assemblies using the following two different syntaxes.
Two compilations create a two-file assembly:
vbc /t:module Admin.vb
vbc personnel.vb /addmodule:Admin.netmodule

One compilation creates a two-file assembly:
vbc /out:Admin.netmodule Admin.vb /out:Personnel.exe Personnel.vb

The Assembly Linker (Al.exe) can be used to create an assembly from a collection of compiled code modules.
To create a multi-file assembly using the Assembly Linker
1. At the command prompt, type the following command:
al < module name > < module name > … /main:< method name > /out:< file name > /target:< assembly file type >
Next Page: .NET Assemblies - Page 2
| Excellent Explanation |