From: Chris Dunaway on
On May 8, 10:53 am, "Jeff Johnson" <i....(a)enough.spam> wrote:
> "Jeff Johnson" <i....(a)enough.spam> wrote in message
>
> news:OfHl6wg7KHA.5848(a)TK2MSFTNGP06.phx.gbl...
>
> >> Technically speaking, you can have a multi-file assembly (several
> >> files make up a single assembly) but I don't think VS can do it.
>
> >>http://msdn.microsoft.com/en-us/library/226t7yxe.aspx
>
> >> I'm not sure if there is any benefit to a multifile assembly.
>
> > I didn't read the article, but if it's what I think it is I believe the
> > main reason for it was to be able to merge the output of multiple
> > languages into a single assembly. And no, Visual Studio can't do it; you
> > have to use command-line tools.
>
> Also, the ultimate output of the assembly linker is a SINGLE file, unless I
> read incorrectly, so when it come to the final output, an assembly is still
> one and only one file. I believe that's pretty much part of the .NET
> definition of "assembly."

I'm not so sure I agree with this. Reading Jeffrey Richter's book
makes me think that an assembly can, in fact, span several files:

"The assembly file that contains the manifest also has an AssemblyRef
table in it. This table contains and entry for all the assemblies
referenced by all the assembly's files."

He goes on to show that 2 files can are created. One file has the
Assembly manifest in it and can be directly referenced. The other is
just IL which cannot be directly referenced.

He cites an example:

Two source files:

RUT.cs contains rarely used types.
FUT.cs contains frequently used types.

He compiles RUT.cs with this command:

csc /t:module RUT.cs

which produces a module file called RUT.netmodule

He compiles FUT.cs with this command:

csc /out:MyTypes.dll /t:library /addmodule:RUT.netmodule FUT.cs

This produces MyTypes.dll which contains the IL for FUT.cs but NOT the
IL for RUT.cs. But the assembly manifest includes the RUT.netmodule
public types.

If an app is written to use MyTypes.dll but never calls any methods
that reference any of the types in RUT.netmodule, then the RUT
netmodule doesn't have to be present.

--Taken from Applied Microsoft .Net Framework Programming, pp 49-52,
Jeffrey Richter.

Again, I don't know if there is any practical use for this, but it is,
in theory, possible.

Chris