What is a Managed Module (compared to an Assembly)?

后端 未结 3 686
忘掉有多难
忘掉有多难 2020-12-15 19:00

What is Managed Module in .NET and how is it different from Assemblies? Is a PE file (eg. test.dll) a managed module or an assembly? How does assembly/managed module corresp

相关标签:
3条回答
  • 2020-12-15 19:25

    A module contains IL and many of them are linked together to create an assembly, which is usually housed in a PE like a .exe or a .dll.

    A PE can contain native (non managed) code as well.

    This is a good intro to the concepts.

    0 讨论(0)
  • 2020-12-15 19:33

    Managed modules are the compiled IL versions of the source code. The extension of the file that is built when making a module from source files is .netmodule.

    Assemblies are either DLLs or .exe files containing managed modules, resources, and metadata.

    0 讨论(0)
  • 2020-12-15 19:36

    A Managed module is generally understood to refer to a module that only contains IL code, with no direct machine code.

    A module is housed in a normal PE file.

    An assembly is a set of 1 or more modules, with one designated as the 'head' (will look up the exact term[1]). A module on its own isnt individually much use though - the assembly is the atomic unit.

    For example, you could have an multui-module assembly with 2 DLLs and an EXE. Multi module assemblies are quite rare though.

    The Don Box book Esssential .NET, the Richter CLR via C# gives good coverage of the topic. For complete details, the Serge Lidin .NET 2.0 IL Assembler book and the CLI standard are more complete.

    [1] According to http://www.programmersheaven.com/2/FAQ-DOTNET-DOTNET-Assembly-Explained

    An assembly can be a single file or it may consist of the multiple files. In case of multi-file, there is one master module containing the manifest while other assemblies exist as non-manifest modules

    To answer the actual questions:-

    What is Managed Module in .NET and how is it different from Assemblies?

    It is a subset - a DLL can be a master module with no child modules -- and thus be an assembly too

    Is a PE file (eg. test.dll) a managed module or an assembly?

    Definitely a module. If it also has a manifest and no child modules, it's also an assembly

    How does assembly/managed module correspond to physical files on disk? Each module is a file. (Tools like ILMerge can merge modules if you're interested)

    0 讨论(0)
提交回复
热议问题