Welcome to OGeek Q&A Community for programmer and developer-Open, Learning and Share
Welcome To Ask or Share your Answers For Others

Categories

0 votes
235 views
in Technique[技术] by (71.8m points)

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

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 correspond to physical files on disk?

See Question&Answers more detail:os

与恶龙缠斗过久,自身亦成为恶龙;凝视深渊过久,深渊将回以凝视…
Welcome To Ask or Share your Answers For Others

1 Reply

0 votes
by (71.8m points)

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)


与恶龙缠斗过久,自身亦成为恶龙;凝视深渊过久,深渊将回以凝视…
OGeek|极客中国-欢迎来到极客的世界,一个免费开放的程序员编程交流平台!开放,进步,分享!让技术改变生活,让极客改变未来! Welcome to OGeek Q&A Community for programmer and developer-Open, Learning and Share
Click Here to Ask a Question

...