Export (0) Print
Expand All

/addmodule (Import Metadata)

/addmodule:file[;file2]

where:

file, file2
An output file that contains metadata. The file cannot contain an assembly manifest. To import more than one file, separate file names with either a comma or a semicolon.

Remarks

All modules added with /addmodule must be in the same directory as the output file at run time. That is, you can specify a module in any directory at compile time but the module must be in the application directory at run time. If the module is not in the application directory at run time, you will get a System.TypeLoadException.

file cannot contain an assembly. For example, if the output file was created with /target:module, its metadata can be imported with /addmodule.

If the output file was created with a /target option other than /target:module, its metadata cannot be imported with /addmodule but can be imported with /reference.

To set this compiler option in the Visual Studio development environment

This compiler option is unavailable in Visual Studio; a project cannot reference a module.

To set this compiler option programmatically

This compiler option cannot be changed programmatically.

Example

Compile source file input.cs and add metadata from metad1.netmodule and metad2.netmodule to produce out.exe:

csc /addmodule:metad1.netmodule;metad2.netmodule /out:out.exe input.cs

See Also

C# Compiler Options

Show:
© 2014 Microsoft