获取将生成的文件的工具。
命名空间: 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)
属性值
类型:Object
将生成文件的工具。
备注
若要将工具与特定文件关联,必须更改其中 ItemType 文件的属性。 请参见本主题中的第二个示例。有关详细信息。
还可以使用 Rules 属性或转换为 IVCRulePropertyStorage 接口的对象提供了此工具。到 MSBuild 基于元数据的规则的访问工具。
示例
下面的代码示例是在集成开发环境 (IDE) (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 安全性
- 对直接调用方的完全信任。此成员不能由部分信任的代码使用。有关详细信息,请参阅通过部分受信任的代码使用库。