次の方法で共有


VCFileConfiguration.Tool プロパティ

ファイルをビルドするツールを取得します。

名前空間:  Microsoft.VisualStudio.VCProjectEngine
アセンブリ:  Microsoft.VisualStudio.VCProjectEngine (Microsoft.VisualStudio.VCProjectEngine.dll 内)

構文

'宣言
Property Tool As Object
Object Tool { get; set; }
property Object^ Tool {
    Object^ get ();
    void set (Object^ value);
}
abstract Tool : Object with get, set
function get Tool () : Object
function set Tool (value : Object)

プロパティ値

型 : System.Object
ファイルをビルドするツール。

解説

特定のファイルに関連付けられたツールを変更するには、ファイルの ItemType のプロパティを変更します。詳細については、このトピックの 2 つ目の例を参照してください。

また Rules のプロパティを使用するか、 IVCRulePropertyStorage インターフェイス、このツールで MSBuild のメタ データへの規則に基づいてアクセスを提供するツールのオブジェクトをキャストできます。

統合開発環境 (IDE) で Tool プロパティを使用するサンプル コードを次に示します。

' 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

指定したファイルに関連付けられたツールを変更する方法を次の例で示します。

' 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

このサンプル コードをコンパイルして実行する方法については、「方法 : プロジェクト モデル機能拡張のプログラム例をコンパイルする」を参照してください。

.NET Framework セキュリティ

  • 直前の呼び出し元に対する完全な信頼。このメンバーは、部分的に信頼されているコードから使用することはできません。詳細については、「部分信頼コードからのライブラリの使用」を参照してください。

参照

関連項目

VCFileConfiguration インターフェイス

Microsoft.VisualStudio.VCProjectEngine 名前空間