共用方式為


/ASSEMBLYDEBUG (Add DebuggableAttribute)

 

The latest version of this topic can be found at -ASSEMBLYDEBUG (Add DebuggableAttribute).

ASSEMBLYDEBUG[:DISABLE]

  
 /ASSEMBLYDEBUG emits the **DebuggableAttribute** attribute with debug information tracking and disables JIT optimizations. This is the same as specifying the following attribute in source:  
  

[assembly:Debuggable(true, true)]; // same as /ASSEMBLYDEBUG

  
 /ASSEMBLYDEBUG:DISABLE emits the **DebuggableAttribute** attribute but disables the tracking of debug information and enables JIT optimizations. This is the same as specifying the following attribute in source:  
  

[assembly:Debuggable(false, false)]; // same as /ASSEMBLYDEBUG:DISABLE

  
 The default is to not emit the **DebuggableAttribute** attribute.  
  
 DebuggableAttribute can also be added to an assembly directly in source code. For example,  
  

[assembly:Debuggable(true, true)]; // same as /ASSEMBLYDEBUG

  
## Remarks  
 In Visual C++ .NET 2003 and later, it is necessary to explicitly specify that a managed image be debuggable. Using [/Zi](../Topic/-Z7,%20-Zi,%20-ZI%20\(Debug%20Information%20Format\).md) alone is not sufficient.  
  
 Other linker options that affect assembly generation are:  
  
-  [/ASSEMBLYLINKRESOURCE](../Topic/-ASSEMBLYLINKRESOURCE%20\(Link%20to%20.NET%20Framework%20Resource\).md)  
  
-  [/ASSEMBLYMODULE](../Topic/-ASSEMBLYMODULE%20\(Add%20a%20MSIL%20Module%20to%20the%20Assembly\).md)  
  
-  [/ASSEMBLYRESOURCE](../Topic/-ASSEMBLYRESOURCE%20\(Embed%20a%20Managed%20Resource\).md)  
  
-  [/DELAYSIGN](../Topic/-DELAYSIGN%20\(Partially%20Sign%20an%20Assembly\).md)  
  
-  [/KEYCONTAINER](../Topic/-KEYCONTAINER%20\(Specify%20a%20Key%20Container%20to%20Sign%20an%20Assembly\).md)  
  
-  [/KEYFILE](../Topic/-KEYFILE%20\(Specify%20Key%20or%20Key%20Pair%20to%20Sign%20an%20Assembly\).md)  
  
-  [/NOASSEMBLY](../Topic/-NOASSEMBLY%20\(Create%20a%20MSIL%20Module\).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 **Debug** property page.  
  
4.  Modify the **Debuggable Assembly** property.  
  
### To set this linker option programmatically  
  
-  See [AssemblyDebug](assetId:///P:Microsoft.VisualStudio.VCProjectEngine.VCLinkerTool.AssemblyDebug?qualifyHint=False&autoUpgrade=True).  
  
## See Also  
 [Setting Linker Options](../Topic/Setting%20Linker%20Options.md)   
 [Linker Options](../Topic/Linker%20Options.md)