This documentation is archived and is not being maintained.

TargetEnvironment Property

Visual Studio .NET 2003

Specifies environment to target. Exposes the functionality of the /env MIDL option.

[Visual Basic .NET]
Public Property TargetEnvironment() As midlTargetEnvironment
[Visual Basic 6]
Property Get TargetEnvironment() As midlTargetEnvironment
Property Let TargetEnvironment( _
   ByVal NewValue As midlTargetEnvironment _
HRESULT __stdcall get_TargetEnvironment(
   /* [out, retval] */ midlTargetEnvironment* retVal
HRESULT __stdcall put_TargetEnvironment(
   /* [in] */ midlTargetEnvironment NewValue
public midlTargetEnvironment TargetEnvironment {get; set;}
[JScript .NET]
public function get TargetEnvironment() : midlTargetEnvironment
public function set TargetEnvironment(
   NewValue : midlTargetEnvironment


Use the midlTargetEnvironment enumeration to change the value of this property.


The following sample code modifies the TargetEnvironment 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 VCMidlTool
        prj = DTE.Solution.Projects.Item(1).Object
        cfgs = prj.Configurations
        cfg = cfgs.Item(1)
        tool = cfg.Tools("VCMIDLTool")
        tool.TargetEnvironment = midlTargetEnvironment.midlTargetWin64
    End Sub
End Module

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

See Also

Applies To: VCMidlTool Object