Exforsys

VB.NET 2005

  1. VB.NET 2005 Free Training
  2. The .NET Framework Architecture Part 1
  3. The .NET Framework Architecture Part 2
  4. Application Class and Message Class
  5. Implementing Class Library Object
  6. Visual Studio.NET Namespaces
  7. .NET Assemblies
  8. Differences between VB.NET 1.0 and VB.NET 2.0
  9. Introducing VB.NET Windows Forms
  10. Visual Studio Windows Forms Designer
  11. Exploring the Forms Designer generated code
  12. Setting and Adding Properties to Windows Form
  13. Implementing Inheritance
  14. Event Handling In Visual Basic .NET
  15. Building Graphical Interface elements
  16. .NET Common Windows Forms Controls Part 1
  17. .NET Common Windows Forms Controls Part 2
  18. Common Controls and Handling Control Events
  19. DomainUpDown and NumericUpDown Controls
  20. Dialog Boxes in Visual Basic .NET
  21. Visual Studio Adding Controls to Windows Form
  22. VB.NET Validation Controls
  23. Working with Menu Controls
  24. VB.NET MDI Applications
  25. .NET Exceptions
  26. VB.NET Creating and Managing Components Part 1
  27. VB.NET Creating and Managing Components Part 2
  28. Simple Data Binding
  29. .NET Complex Data Binding
  30. .NET Data Form Wizard
  31. Data Manipulation with ADO.NET
  32. SQL Server Stored Procedures
  33. SQL Server Ad Hoc Queries
  34. Finding and Sorting Data in DataSets
  35. ADO.NET Object Model
  36. Working with DataSets
  37. Using XML Data
  38. Working with File System in .NET
  39. Creating Web Service
  40. Instantiating - Invoking Web Services, Creating Proxy Classes with WSDL
  41. Web Reference and Web Services
  42. Web Services - SOAP, WSDL, Disco and UDDI
  43. Web Application Testing in VB.NET 2005
  44. Web Application Tracing and Debugging
  45. Working with Legacy Code and COM Components
  46. ActiveX Controls and Legacy Code
  47. Windows Application Testing
  48. VB.NET Windows Application Testing
  49. Tracing VB.NET Windows Application
  50. Debugging Windows Applications In Visual Studio.NET 2005
  51. Deploying Windows Applications In Visual Studio.NET 2005
  52. Customizing Setup Project in Visual Studio.NET 2005
  53. Shared Assembly
  54. Microsoft .NET Creating Installation Components
  55. The Registry Editor in Visual Studio.NET 2005
  56. The File Types Editor

Ads


Home arrow Technical Training arrow VB.NET 2005

.NET Assemblies

Page 1 of 3
Author : Exforsys Inc.     Published on: 7th Jul 2005    |   Last Updated on: 24th Dec 2007

Creating and Managing .NET Assemblies

Single-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

Ads

Single-file and multi-file assemblies

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:

Combining modules written in different languages:

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.

Creating a multi-file assembly

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:

Click here for Sample Code

End Namespace

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.

Click here for Sample Code

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

Ads

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 >



 
This tutorial is part of a VB.NET 2005 tutorial series. Read it from the beginning and learn yourself.

VB.NET 2005

  1. VB.NET 2005 Free Training
  2. The .NET Framework Architecture Part 1
  3. The .NET Framework Architecture Part 2
  4. Application Class and Message Class
  5. Implementing Class Library Object
  6. Visual Studio.NET Namespaces
  7. .NET Assemblies
  8. Differences between VB.NET 1.0 and VB.NET 2.0
  9. Introducing VB.NET Windows Forms
  10. Visual Studio Windows Forms Designer
  11. Exploring the Forms Designer generated code
  12. Setting and Adding Properties to Windows Form
  13. Implementing Inheritance
  14. Event Handling In Visual Basic .NET
  15. Building Graphical Interface elements
  16. .NET Common Windows Forms Controls Part 1
  17. .NET Common Windows Forms Controls Part 2
  18. Common Controls and Handling Control Events
  19. DomainUpDown and NumericUpDown Controls
  20. Dialog Boxes in Visual Basic .NET
  21. Visual Studio Adding Controls to Windows Form
  22. VB.NET Validation Controls
  23. Working with Menu Controls
  24. VB.NET MDI Applications
  25. .NET Exceptions
  26. VB.NET Creating and Managing Components Part 1
  27. VB.NET Creating and Managing Components Part 2
  28. Simple Data Binding
  29. .NET Complex Data Binding
  30. .NET Data Form Wizard
  31. Data Manipulation with ADO.NET
  32. SQL Server Stored Procedures
  33. SQL Server Ad Hoc Queries
  34. Finding and Sorting Data in DataSets
  35. ADO.NET Object Model
  36. Working with DataSets
  37. Using XML Data
  38. Working with File System in .NET
  39. Creating Web Service
  40. Instantiating - Invoking Web Services, Creating Proxy Classes with WSDL
  41. Web Reference and Web Services
  42. Web Services - SOAP, WSDL, Disco and UDDI
  43. Web Application Testing in VB.NET 2005
  44. Web Application Tracing and Debugging
  45. Working with Legacy Code and COM Components
  46. ActiveX Controls and Legacy Code
  47. Windows Application Testing
  48. VB.NET Windows Application Testing
  49. Tracing VB.NET Windows Application
  50. Debugging Windows Applications In Visual Studio.NET 2005
  51. Deploying Windows Applications In Visual Studio.NET 2005
  52. Customizing Setup Project in Visual Studio.NET 2005
  53. Shared Assembly
  54. Microsoft .NET Creating Installation Components
  55. The Registry Editor in Visual Studio.NET 2005
  56. The File Types Editor
 

Comments

 

Share


Connect

Related Articles

Exforsys e-Newsletter

Enhance Technical and Soft Skills every week, get our Job Interview Questions and Answers eBook free when you subscribe.

Subscribe and Get Free Bonus PDF Book

eBook

Subscribe