.NET 中的托管模块是什么?它与程序集有何不同? PE 文件(例如 test.dll)是托管模块还是程序集?汇编/托管模块如何对应磁盘上的物理文件?
最佳答案
Managed module一般理解为只包含IL代码,没有直接机器码的模块。
模块位于普通 PE 文件中。
程序集是一组 1 个或多个模块,其中一个指定为“头”(将查找确切的术语 [1])。尽管模块本身并没有多大用处 - 程序集是原子单元。
例如,您可以拥有一个包含 2 个 DLL 和一个 EXE 的多模块程序集。不过,多模块组件非常少见。
Don Box 的书 Esssential .NET, the Richter CLR via C# 很好地涵盖了这个主题。有关完整的详细信息,Serge Lidin .NET 2.0 IL Assembler 一书和 CLI 标准更加完整。
[1] 根据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
回答实际问题:-
What is Managed Module in .NET and how is it different from Assemblies?
它是一个子集——一个 DLL 可以是一个没有子模块的主模块——因此也是一个程序集
Is a PE file (eg. test.dll) a managed module or an assembly?
绝对是一个模块。如果它也有 list 但没有子模块,那么它也是一个程序集
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)
关于c# - 什么是托管模块(与程序集相比)?,我们在Stack Overflow上找到一个类似的问题: https://stackoverflow.com/questions/1326556/