I first ran into netmodules before VS 2002 was shipped. The netmodule gave me precisely what I asked for, without actually solving my problem. I wanted to use multiple languages (C#, and C++ /clr) in a single assembly. It turns out a single assembly can be multi-module. Multi-module means a single .Net assembly is spread across multiple win32 dlls. What I really wanted was a single module assembly written in multiple languages. Netmodules couldn't solve my problem back then, but with the VS 2005 C++ linker they can now.
Check out JuFeng's articles for some more in depth coverage, and an explanation why you might want a multi-module assembly:
Netmodule vs. Assembly
Since JuFeng's examples didn't show how to create debug info I thought I'd make an updated example here.
Here's a quick example with a multi-module assembly:
From the Visual Studio 2005 Command Prompt:
C:\blog\linkexample>vbc /target:module /debug+ b.vb
C:\blog\linkexample>csc /debug+ /addmodule:b.netmodule a.cs
C:\blog\linkexample>devenv /debugexe a.exe
Check out the modules window:
And the callstack window:
To get a single file assembly I'll need to recompile the cs file into a netmodule then use the c++ linker.
C:\blog\linkexample>csc /addmodule:b.netmodule /target:module /debug+ a.cs
C:\blog\linkexample>link /entry:fooCS.Main /out:theone.exe /subsystem:console /debug a.netmodule b.netmodule
C:\blog\linkexample>devenv /debugexe theone.exe
Now check out the modules window: