共用方式為


VCCLCompilerTool.Optimization Property

Definition

Gets or sets options for code optimization. Optimization exposes the functionality of the compiler's /Od (Disable (Debug)), /O1, /O2 (Minimize Size, Maximize Speed), and /Ox (Full Optimization) options.

public:
 property Microsoft::VisualStudio::VCProjectEngine::optimizeOption Optimization { Microsoft::VisualStudio::VCProjectEngine::optimizeOption get(); void set(Microsoft::VisualStudio::VCProjectEngine::optimizeOption value); };
public:
 property Microsoft::VisualStudio::VCProjectEngine::optimizeOption Optimization { Microsoft::VisualStudio::VCProjectEngine::optimizeOption get(); void set(Microsoft::VisualStudio::VCProjectEngine::optimizeOption value); };
[System.Runtime.InteropServices.DispId(30)]
public Microsoft.VisualStudio.VCProjectEngine.optimizeOption Optimization { [System.Runtime.InteropServices.DispId(30)] get; [System.Runtime.InteropServices.DispId(30)] set; }
[<System.Runtime.InteropServices.DispId(30)>]
[<get: System.Runtime.InteropServices.DispId(30)>]
[<set: System.Runtime.InteropServices.DispId(30)>]
member this.Optimization : Microsoft.VisualStudio.VCProjectEngine.optimizeOption with get, set
Public Property Optimization As optimizeOption

Property Value

An optimizeOption value.

Attributes

Examples

See How to: Compile Example Code for Project Model Extensibility for information about how to compile and run this example.

The following example modifies the Optimization property in the integrated development environment (IDE):

' add reference to Microsoft.VisualStudio.VCProjectEngine.  
Imports EnvDTE  
Imports Microsoft.VisualStudio.VCProjectEngine  

Public Module Module1  
    Sub Test()  
        Dim prj As VCProject  
        Dim cfgs, tools As IVCCollection  
        Dim cfg As VCConfiguration  
        Dim tool As VCCLCompilerTool  
        prj = DTE.Solution.Projects.Item(1).Object  
        cfgs = prj.Configurations  
        cfg = cfgs.Item(1)  
        tool = cfg.Tools("VCCLCompilerTool")  
        tool.Optimization = optimizeOption.optimizeMinSpace  
    End Sub  
End Module  

Applies to