从TFS Team Build脚本获取XML文档文件 [英] Get XML Documentation files from TFS Team Build script
问题描述
I have a dependency replication scheme setup in our TFS environment based on http://geekswithblogs.net/jakob/archive/2009/03/05/implementing-dependency-replication-with-tfs-team-build.aspx.
这使用 CompilationOutputs
项目组以获取生成的DLL文件并将其分支/合并到相关项目中.我的问题是CompilationOutputs
项目组仅包含DLL,并且我还希望包含XML文档文件,因此在使用这些库时可以获得智能提示文档提示.是否有一个包含这些的不同项目组,或一个不同的方法?我需要手动查找xml文件并将其添加到项目组吗?
This uses the CompilationOutputs
item group to get the built DLL files and branch/merge them into dependent projects. My problem is that the CompilationOutputs
item group only contains the DLLs, and I'd like to also include the XML documentation files, so I can get intellisense documentation tips when using these libraries. Is there a different item group that contains these, or a different approach? Do I need to manually find the xml files and add them to an item group?
我们现在正在使用TFS 2010,因此,如果那里有新内容,我们可以尝试利用它(尽管如果我不必将整个方案转换为使用工作流流程,那将是很好的选择). ..)
We're on TFS 2010 now, so if there's something new there, we can try to take advantage of it (though it'd be nice if I didn't have to convert this whole scheme to use a Workflow process...)
推荐答案
根据您复制并检入输出的文章:
According to the article you copy and checkin the outputs:
<Copy SourceFiles="@(CompilationOutputs)" DestinationFolder="$(ReplicateSourceFolder)"/>
<Exec Command="$(TF) checkin /comment:"Checking in file from build" "$(ReplicateSourceFolder)" /recursive"/>
您不能在签入之前添加第二个复制行以使用元数据复制xml文件吗?
Couldn't you add a second copy line before the checkin to copy the xml files using the metadata?
<Copy SourceFiles="%(CompilationOutputs.RootDir)%(CompilationOutputs.Directory)\%(CompilationOutputs.Filename).xml" DestinationFolder="$(ReplicateSourceFolder)"/>
这里是使用内联任务的另一个选项,该任务构建另一个项目组来更改扩展名,以便仅添加实际存在的文档文件:
Here is another option using an inline task that builds another item group changing the extension so that it only adds doc files that actually exist:
<Target Name="Test">
<ChangeExtension InputFiles="@(CompilationOutputs)" Extension=".xml">
<Output TaskParameter="OutputFiles" ItemName="DocFiles" />
</ChangeExtension>
<Copy SourceFiles="@(CompilationOutputs)" DestinationFolder="$(ReplicateSourceFolder)"/>
<Copy SourceFiles="@(DocFiles)" DestinationFolder="$(ReplicateSourceFolder)"/>
</Target>
<UsingTask TaskName="ChangeExtension" TaskFactory="CodeTaskFactory" AssemblyFile="$(MSBuildToolsPath)\Microsoft.Build.Tasks.v4.0.dll">
<ParameterGroup>
<InputFiles ParameterType="Microsoft.Build.Framework.ITaskItem[]" Required="true"/>
<Extension ParameterType="System.String" Required="true"/>
<OutputFiles ParameterType="Microsoft.Build.Framework.ITaskItem[]" Output="true"/>
</ParameterGroup>
<Task>
<Code Type="Fragment" Language="cs">
<![CDATA[
if (InputFiles.Length > 0)
{
List<TaskItem> results = new List<TaskItem>();
for (int i = 0; i < InputFiles.Length; i++)
{
ITaskItem item = InputFiles[i];
string path = item.GetMetadata("FullPath");
string docfile = Path.ChangeExtension(path, Extension);
if (File.Exists(docfile))
{
results.Add(new TaskItem(docfile));
}
}
OutputFiles = results.ToArray();
}
]]>
</Code>
</Task>
</UsingTask>
这篇关于从TFS Team Build脚本获取XML文档文件的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持IT屋!