Example how to create several modules and link theme into a single dll:
csc /t:module RarelyUsedTypes.cs
csc /out:AllTypes.dll /t:library /addmodule:RarelyUsedTypes.netmodule AllTypes.cs
For more information see Richter's book CLR via C#.
You can automate this process for Visual Studio.
For each of your projects create a netmodule or an assembly and compile/merge them all into a single assembly.
First alternative. This was proposed by Jay R. Wren:
This is a cute hack, but with the CSC and VBC both supporting the /target:module and /addmodule options, you could actually do this without ILMerge just by using a shell script or make file.
Visual Studio doesn't support the "netmodule" type, but MSBuild does.
Add the VB project to your solution. Unload the project and edit the project file.
Change OutputType to module : module
Instead of adding a reference to the desired project, we add a module. Sadly, again VStudio fails here, but MSBUILD works just fine. Unload the project and edit the project file. Add an item group with AddModules include directives.
This will tell msbuild to tell CSC to use /addmodule directives, just like the Reference Item Group which Studio does manage.
Major Drawback: No Visual Studio Intellisense for the added module. We already have references, it is too bad we don't have modules.
SharpDevelop has the first step, but the second step, an "Add Module" gui has been open as a low priority item since SD 2.0.
Second way. This great article (by Skott Hanselman) describes how to megre assemblies automatically if you're using Visual Studio. It does give you IntelliSense support, unlike the first alternative.