1

In my book, "Pro C# 2008 and the .NET 3.5 Platform", there is a line of text that is confusing me, within the context of Single-File assemblies.

In a great number of cases, there is a simple one-to-one correspondence between a .NET assembly and the binary file (*.dll or *.exe). Thus if you are building a .NET *.dll, it is safe to consider that the binary and the assembly are one and the same. Likewise, if you are building an executable desktop application, the *.exe can simply be referred to as the assembly itself

-Pro C# 2008 and the .NET 3.5 platform, Andrew Troelsen

The first sentence of the quote is messing my thinking up. I understand a .NET Single file assembly to be a logical grouping of one or more related modules that are intended to be initially deployed and versioned as a single unit. Within this assembly, contains Windows/CLR headers, type metadata, compiled CIL, and an assembly manifest.

Within the context of single file assemblies, I fail to understand what is meant by a "one-to-one correspondence between a .NET assembly and the binary file (*.dll or *.exe).

Could someone please clarify the quote specified above?

contactmatt
  • 18,116
  • 40
  • 128
  • 186

4 Answers4

3

It is a sucky comment, designed by the author to cover his ass. But pointless when he doesn't explain what it means. Your mental model about how Visual Studio works is intact, one project creates one assembly.

But as you guessed, the CLR doesn't have this requirement. An assembly can be built-up from multiple modules. The important ingredients are the /target:module option for the C# compiler and the al.exe tool to link the modules into an assembly. These options are very important to Microsoft, that's how core assemblies like mscorlib.dll get built. Soul of the machine stuff, you shouldn't ever have to decent that far.

Hans Passant
  • 922,412
  • 146
  • 1,693
  • 2,536
0

This is just a matter of defintion. Any assembly that is contained in a single binary can be called a single file assembly.

Simply said - an assembly can be contained in one or more binaries. A assembly that is in a single binary is a single file assembly.

-foredecker

Foredecker
  • 7,395
  • 4
  • 29
  • 30
0

I've never seen an assembly span multiple dll or exe files. You can use ILmerge to combine multiple assemblies into a single binary, however. Generally, you will see one assembly dll per namespace.

Mark Richman
  • 28,948
  • 25
  • 99
  • 159
0

I think what he's referring to is that a "Web site project" compiles individual code behind files into individual binary files, but they are considered part of the same "assembly". You can see these files in the temporary location under windows\Microsoft .net framework

Erik Funkenbusch
  • 92,674
  • 28
  • 195
  • 291