F.5. Compiling to modules

Instead of compiling your source file into an assembly, you can also compile it into a module (.netmodule file). You can compile a C# source file into a module using the /target:module option. The following commands will generate Class1.netmodule and Class2.netmodule from their respective source files:

c:\expt>csc /target:module Class1.cs
c:\expt>csc /target:module Class2.cs

To link both modules into a single DLL assembly, you can do this:

c:\expt>al /out:Class3.dll Class1.netmodule Class2.netmodule

AL.exe (Assembly Linker [6]) is a tool which generates a file with an assembly manifest from one or more files that are either modules or resource files.

[6] Also known as the Assembly Generation Tool in Microsoft documentation. ...

Get From Java to C#: A Developer's Guide now with the O’Reilly learning platform.

O’Reilly members experience books, live events, courses curated by job role, and more from O’Reilly and nearly 200 top publishers.