共用方式為


/ASSEMBLYMODULE (Add a MSIL Module to the Assembly)

 

The latest version of this topic can be found at -ASSEMBLYMODULE (Add a MSIL Module to the Assembly).

ASSEMBLYMODULE:filename

  
## Remarks  
 where:  
  
 *filename*  
 The module you want to include in this assembly.  
  
## Remarks  
 The /ASSEMBLYMODULE option allows you to add a module reference to an assembly. Type information in the module will not be available to the assembly program that added the module reference. However, type information in the module will be available to any program that references the assembly.  
  
 Use [#using](../Topic/%23using%20Directive%20\(C++\).md) to both add a module reference to an assembly and make the module's type information available to the assembly program.  
  
 For example, consider the following scenario:  
  
1.  Create a module with [/LN](../Topic/-LN%20\(Create%20MSIL%20Module\).md).  
  
2.  Use /ASSEMBLYMODULE in a different project to include the module in the current compilation, which will create an assembly. This project will not reference the module with `#using`.  
  
3.  Any project that references this assembly can now also use types from the module.  
  
 Other linker options that affect assembly generation are:  
  
-  [/ASSEMBLYDEBUG](../Topic/-ASSEMBLYDEBUG%20\(Add%20DebuggableAttribute\).md)  
  
-  [/ASSEMBLYLINKRESOURCE](../Topic/-ASSEMBLYLINKRESOURCE%20\(Link%20to%20.NET%20Framework%20Resource\).md)  
  
-  [/ASSEMBLYRESOURCE](../Topic/-ASSEMBLYRESOURCE%20\(Embed%20a%20Managed%20Resource\).md)  
  
-  [/DELAYSIGN](../Topic/-DELAYSIGN%20\(Partially%20Sign%20an%20Assembly\).md)  
  
-  [/NOASSEMBLY](../Topic/-NOASSEMBLY%20\(Create%20a%20MSIL%20Module\).md)  
  
-  [/KEYFILE](../Topic/-KEYFILE%20\(Specify%20Key%20or%20Key%20Pair%20to%20Sign%20an%20Assembly\).md)  
  
-  [/KEYCONTAINER](../Topic/-KEYCONTAINER%20\(Specify%20a%20Key%20Container%20to%20Sign%20an%20Assembly\).md)  
  
 The Visual C++ linker accepts .netmodule files as input and the output file produced by the linker will be an assembly or .netmodule with no run-time dependence on any of the .netmodules that were input to the linker.  For more information, see [.netmodule Files as Linker Input](../Topic/.netmodule%20Files%20as%20Linker%20Input.md).  
  
### To set this linker option in the Visual Studio development environment  
  
1.  Open the project's **Property Pages** dialog box. For details, see [Setting Visual C++ Project Properties](../Topic/Working%20with%20Project%20Properties.md).  
  
2.  Click the **Linker** folder.  
  
3.  Click the **Input** property page.  
  
4.  Modify the **Add Module to Assembly** property.  
  
### To set this linker option programmatically  
  
-  See [AddModuleNamesToAssembly](assetId:///P:Microsoft.VisualStudio.VCProjectEngine.VCLinkerTool.AddModuleNamesToAssembly?qualifyHint=False&autoUpgrade=True).  
  
## See Also  
 [Setting Linker Options](../Topic/Setting%20Linker%20Options.md)   
 [Linker Options](../Topic/Linker%20Options.md)