Поделиться через


VCFileConfiguration.Tool - свойство

Gets or sets the tool that will build the file.

Пространство имен:  Microsoft.VisualStudio.VCProjectEngine
Сборка:  Microsoft.VisualStudio.VCProjectEngine (в Microsoft.VisualStudio.VCProjectEngine.dll)

Синтаксис

'Декларация
Property Tool As Object
'Применение
Dim instance As VCFileConfiguration
Dim value As Object

value = instance.Tool

instance.Tool = value
Object Tool { get; set; }
property Object^ Tool {
    Object^ get ();
    void set (Object^ value);
}
function get Tool () : Object
function set Tool (value : Object)

Значение свойства

Тип: System.Object

The tool that will build the file.

Заметки

In order to change a tool associated with a particular file, you must retrieve the tool object from the FileTools collection of the VCConfiguration object, and use it to reset the tool. See the second example in this topic for details.

Примеры

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

        ' retrieves the tool
        prj = DTE.Solution.Projects.Item(1).Object
        col2 = prj.Configurations
        Dim config As VCConfiguration
        config = col2.Item("Debug|Win32")
        tool = config.FileTools.Item(5)

        ' changes the tool associated with a file
        col = prj.Files
        file = col.Item(1)
        col = file.FileConfigurations
        fileconfig = col.Item("Debug|Win32")
        MsgBox(fileconfig.Tool.ToolName)
        fileconfig.Tool = tool
        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.

Разрешения

  • Полное доверие для непосредственно вызывающего метода. Этот член не может быть использован частично доверенным кодом. Дополнительные сведения см. в разделе Using Libraries from Partially Trusted Code.

См. также

Ссылки

VCFileConfiguration Интерфейс

VCFileConfiguration - члены

Microsoft.VisualStudio.VCProjectEngine - пространство имен