Freigeben über


VCCLCompilerTool.PreprocessorDefinitions-Eigenschaft

Ruft eine oder mehrere Präprozessordefinitionen ab oder legt diese fest. PreprocessorDefinitions macht die Funktionen der /D (Präprozessordefinitionen)-Option des Compilers, der Eigenschaftenseiten "MIDL": "Allgemein"-Option des MIDL-Compilers und der Eigenschaftenseiten "Ressourcen"-Option des Ressourcencompilers verfügbar.

Namespace:  Microsoft.VisualStudio.VCProjectEngine
Assembly:  Microsoft.VisualStudio.VCProjectEngine (in Microsoft.VisualStudio.VCProjectEngine.dll)

Syntax

'Declaration
Property PreprocessorDefinitions As String
string PreprocessorDefinitions { get; set; }
property String^ PreprocessorDefinitions {
    String^ get ();
    void set (String^ value);
}
abstract PreprocessorDefinitions : string with get, set
function get PreprocessorDefinitions () : String 
function set PreprocessorDefinitions (value : String)

Eigenschaftswert

Typ: String
Eine oder mehrere Präprozessordefinitionen.

Beispiele

Siehe Gewusst wie: Kompilieren von Beispielcode für die Erweiterbarkeit von Projektmodellen zu Informationen darüber, wie dieses Beispiel kompiliert und ausgeführt wird.

Im folgenden Beispiel wird die Eigenschaft PreprocessorDefinitions des Compilers in der integrierten Entwicklungsumgebung (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
        Dim oldDefs As String
        prj = DTE.Solution.Projects.Item(1).Object
        cfgs = prj.Configurations
        cfg = cfgs.Item(1)
        tool = cfg.Tools("VCCLCompilerTool")
        oldDefs = tool.PreprocessorDefinitions
        tool.PreprocessorDefinitions = "_TEST;" + oldDefs
        MsgBox(tool.PreprocessorDefinitions)
    End Sub
End Module

.NET Framework-Sicherheit

Siehe auch

Referenz

VCCLCompilerTool Schnittstelle

Microsoft.VisualStudio.VCProjectEngine-Namespace