This documentation is archived and is not being maintained.

PreprocessorDefinitions Property

Visual Studio .NET 2003

Specifies one or more preprocessor defines. Exposes the functionality of the compiler's /D option, the MIDL compiler's /D option, and the Resource Compiler's /r option.

[Visual Basic .NET]
Public Property PreprocessorDefinitions() As String
[Visual Basic 6]
Property Get PreprocessorDefinitions() As String
Property Let PreprocessorDefinitions( _
   ByVal NewValue As String _
HRESULT __stdcall get_PreprocessorDefinitions(
   /* [out, retval] */ BSTR* retVal
HRESULT __stdcall put_PreprocessorDefinitions(
   /* [in] */ BSTR NewValue
public string PreprocessorDefinitions {get; set;}
[JScript .NET]
public function get PreprocessorDefinitions() : String
public function set PreprocessorDefinitions(
   NewValue : String


The following sample code modifies the compiler's PreprocessorDefinitions property in the development environment:

' 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
    End Sub
End Module

See Samples for Project Model Extensibility for information on how to compile and run this sample.

See Also

Applies To: VCCLCompilerTool Object | VCMidlTool Object | VCResourceCompilerTool Object