Share via


VCFileConfiguration.Tool Property

Definition

Gets the tool that will build the file.

public:
 property System::Object ^ Tool { System::Object ^ get(); void set(System::Object ^ value); };
public:
 property Platform::Object ^ Tool { Platform::Object ^ get(); void set(Platform::Object ^ value); };
[System.Runtime.InteropServices.DispId(500)]
public object Tool { [System.Runtime.InteropServices.DispId(500)] get; [System.Runtime.InteropServices.DispId(500)] set; }
[<System.Runtime.InteropServices.DispId(500)>]
[<get: System.Runtime.InteropServices.DispId(500)>]
[<set: System.Runtime.InteropServices.DispId(500)>]
member this.Tool : obj with get, set
Public Property Tool As Object

Property Value

The tool that will build the file.

Attributes

Examples

The following sample code uses the Tool 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 file, file2 As VCFile  
        Dim col As IVCCollection  
        Dim fileconfig As VCFileConfiguration  
        Dim prj As VCProject  
        prj = DTE.Solution.Projects.Item(1).Object  
        col = prj.Files  
        file = col.Item(1)  
        col = file.FileConfigurations  
        fileconfig = col.Item("Debug|Win32")  
       MsgBox(fileconfig.Tool.ToolName)  
    End Sub  
End Module  

The following sample shows how to change the tool associated with a given file.

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

Public Module Module1  
    Sub Test()  
        Dim file, file2 As VCFile  
        Dim col As IVCCollection  
        Dim col2 As IVCCollection  
        Dim fileconfig As VCFileConfiguration  
        Dim prj As VCProject  
        Dim tool As Object  

        ' changes the tool associated with a file  
        col = prj.Files  
        file = col.Item(1)  
        file.ItemType = "CLCompile"  
        MsgBox(fileconfig.Tool.ToolName)  
    End Sub  
End Module  

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

Remarks

In order to change a tool associated with a particular file, you must change the ItemType property for the file. See the second example in this topic for details.

You can also use the Rules property, or cast the tool object to the IVCRulePropertyStorage interface to provide rule-based access to the MSBuild metadata for this tool.

Applies to