【发布时间】:2018-07-29 18:59:38
【问题描述】:
我正在处理一个自定义 MSBuild 任务,以调用现有的源代码生成工具来重新格式化错误输出,使其与 Visual Studio 的文件名和行号预期相匹配。我有这个工作,如果我构建项目(从命令行或在 VS 本身内)我的自定义任务运行,并且在从 VS 内构建的情况下,构建窗口输出是我想要的。
但是,Visual Studio 项目资源管理器实际上并没有显示输入文件。我添加了 AvailableItemName 和 PropertyPageSchema 项目,我还添加了文件扩展名到 Tools->Options、“Projects and Solutions”->“VC++ Project Settings”、“Extensions to include”,甚至尝试更改“Source”的扩展名列表文件”组在我的测试项目中。我还缺少什么?
这是我的 .targets 文件(我添加了一个 .user.props(在意识到 XML 存在问题后进行了更新,但修复并没有解决解决方案资源管理器问题)
<?xml version="1.0" encoding="utf-8"?>
<ProjectSchemaDefinitions
xmlns="http://schemas.microsoft.com/build/2009/properties"
xmlns:x="http://schemas.microsoft.com/winfx/2006/xaml"
xmlns:sys="clr-namespace:System;assembly=mscorlib">
<ItemType
Name="ToolName"
DisplayName="Tool" />
<ContentType Name="ToolName" DisplayName="Tool Name" ItemType="ToolName">
</ContentType>
<FileExtension Name=".<ext>" ContentType="ToolName">
</FileExtension>
<Rule Name="ToolName" PageTemplate="tool" DisplayName="Tool" Order="5">
<Rule.Categories>
<Category Name="General" DisplayName="General" />
</Rule.Categories>
<Rule.DataSource>
<DataSource Persistence="ProjectFile" ItemType="ToolName" Label="" HasConfigurationCondition="true" />
</Rule.DataSource>
<StringProperty Name="OutputFile" DisplayName="Output File" Description="Names the produced output file" Category="General"/>
<StringProperty Name="HeaderFile" DisplayName="Header File" Description="Names the produced header file" Category="General"/>
<StringProperty Name="ReportFile" DisplayName="Report File" Description="Names the produced report file" Category="General"/>
</Rule>
</ProjectSchemaDefinitions>
【问题讨论】:
标签: visual-studio msbuild visual-studio-2017