Creating and Using Multifile Assemblies
page 5 of 7
by J. Ambrose Little
Feedback
Average Rating: This article has not yet been rated.
Views (Total / Last 10 Days): 34371/ 50

Option 2: /addmodule Compiler Switch

Next let's look at another method of creating a multifile assembly.  Both the VB.NET Compiler and the C# Compiler support an /addmodule switch that allows you to automatically link modules into the assembly that you are building with the compiler executive.  I have done this in my example in the BuildWithCSC.bat (Figure 4).

Figure 4

The first part of the batch file is the exact same as in the first option, setting the path and building the VB.NET module.  The difference is that instead of building the C# project as a module (as in Figure 3), we build it as an assembly, linking the VB.NET module to it (see Figure 5).  First, we change the /t[arget] option to specify that we want to build a code library instead of a module (Figure 5, Line 3), as we did previously.  Next, we use the /addmodule switch to add the VBLibrary.netmodule (Figure 5, Line 5), and last, we specify our assembly name (MultifileAssembly.dll) instead of CSLibrary.netmodule, as we did previously.

Figure 5

The net result of this is that we end up with only two files in our assembly, VBLibrary.netmodule and MultifileAssembly.dll, instead of the three we had previoiusly.  And now, instead of having an assembly file with only the assembly manifest, we now have the assembly manifest built into the same file with the C# project code.  This method might be preferred in situation where speed of deployment is less of an issue and having fewer files is more important.  Ultimately, the CLR does not care which method you choose because both will act like one assemly as far as it is concerned, and the same goes for VB.NET and C# compilers (and likely most other compilers).

 


View Entire Article

User Comments

Title: very good article and explanantion   
Name: Jon
Date: 2005-08-12 12:18:56 AM
Comment:
I don't use Visual Studio for .net development, so this is excellent information for my work.

Thanks
Title: fd   
Name: sp
Date: 2005-07-06 7:08:13 AM
Comment:
good
Title: Good quick explanation of the al   
Name: Tom
Date: 2004-09-28 1:06:37 PM
Comment:
I was looking for a quick explanation of the assembly linker and I found this through a search on the web. It was concise and well written. Thanks.






Community Advice: ASP | SQL | XML | Regular Expressions | Windows


©Copyright 1998-2023 ASPAlliance.com  |  Page Processed at 2023-12-06 3:23:01 AM  AspAlliance Recent Articles RSS Feed
About ASPAlliance | Newsgroups | Advertise | Authors | Email Lists | Feedback | Link To Us | Privacy | Search