-target:module(C# 编译器选项)-target:module (C# Compiler Options)

此选项会导致编译器不生成程序集清单。This option causes the compiler to not generate an assembly manifest.

语法Syntax

-target:module  

备注Remarks

默认情况下,使用此选项编译时所创建的输出文件具有扩展名 .netmodule。By default, the output file created by compiling with this option will have an extension of .netmodule.

.NET Framework 公共语言运行时无法加载不含程序集清单的文件。A file that does not have an assembly manifest cannot be loaded by the .NET Framework common language runtime. 但是,此类文件可以通过 -addmodule 合并到程序集的程序集清单中。However, such a file can be incorporated into the assembly manifest of an assembly by means of -addmodule.

如果在一次编译中创建了多个模块,某个模块中的内部类型将适用于编译中的其他模块。If more than one module is created in a single compilation, internal types in one module will be available to other modules in the compilation. 如果一个模块中的代码引用另一模块中的 internal 类型,则两个模块必须通过 -addmodule 合并到一个程序集清单中。When code in one module references internal types in another module, then both modules must be incorporated into an assembly manifest, by means of -addmodule.

Visual Studio 开发环境中不支持创建模块。Creating a module is not supported in the Visual Studio development environment.

有关如何以编程方式设置此编译器选项的信息,请参阅 OutputTypeFor information on how to set this compiler option programmatically, see OutputType.

示例Example

通过创建 in.netmodule 编译 in.csCompile in.cs, creating in.netmodule:

csc -target:module in.cs  

请参阅See also