TeamCity 通过工件路径将 fxcop 和coveragereport 添加到构建工件中

发布于 2024-11-09 11:41:37 字数 673 浏览 3 评论 0原文

我正在尝试获取 fxCop 结果 xml 和coveragereport.xml 以在构建后发布到工件。

以下是我现在所拥有的,

%system.teamcity.build.tempDir%/fxcop-output*/fxcop-result.xml => BuildLog/FxCop
%system.teamcity.build.tempDir%/teamcity*ncover/CoverageReport.xml => BuildLog/Coverage

但结果目录具有以下格式

BuildLog --> Coverage --> teamcity8681981431807223307ncover --> CoverageReport.xml
BuildLog --> FxCop --> fxcop-output-3810116228914218788 --> fxcop-result.xml

我很好奇我应该做什么才能使其如下而不包含文件夹结构。

BuildLog --> Coverage --> CoverageReport.xml
BuildLog --> FxCop --> fxcop-result.xml

谢谢

i'm trying to get the fxCop result xml and coveragereport.xml to publish to the artifacts after build.

the following is what I have now,

%system.teamcity.build.tempDir%/fxcop-output*/fxcop-result.xml => BuildLog/FxCop
%system.teamcity.build.tempDir%/teamcity*ncover/CoverageReport.xml => BuildLog/Coverage

but the result directory has the following format

BuildLog --> Coverage --> teamcity8681981431807223307ncover --> CoverageReport.xml
BuildLog --> FxCop --> fxcop-output-3810116228914218788 --> fxcop-result.xml

I am curious what should I do to make it like the following without the containing folder structure.

BuildLog --> Coverage --> CoverageReport.xml
BuildLog --> FxCop --> fxcop-result.xml

thanks

如果你对这篇内容有疑问,欢迎到本站社区发帖提问 参与讨论,获取更多帮助,或者扫码二维码加入 Web 技术交流群。

扫码二维码加入Web技术交流群

发布评论

需要 登录 才能够评论, 你可以免费 注册 一个本站的账号。

评论(1

几度春秋 2024-11-16 11:41:37

由于工件源定义中存在一个星号 (*),因此搜索模式可能会抓取多个源文件。

为了区分输出路径中的这些(理论上多个)文件,TeamCity 将在输出结构中添加 * - 模式的匹配,例如 [...]teamcity 8681981431807223307 ncover[...]。因此,不可能选择(可能)多个文件并将它们存储为一个文件。

也许不同的方法就是答案。您可以编写一个使用 TeamCity Build 的 MSBuild 脚本脚本交互功能,与此类似:

<Project xmlns="http://schemas.microsoft.com/developer/msbuild/2003" 
     ToolsVersion="4.0">

<ItemGroup>
  <FxCopResults Include="%system.teamcity.build.tempDir%/fxcop-output*/fxcop-result.xml" />
  <CoverageResults Include="%system.teamcity.build.tempDir%/teamcity*ncover/CoverageReport.xml" />
</ItemGroup>

<Target Name="PublishArtifacts">
  <Message Text="##teamCity[publishArtifacts '%(FxCopResults) => BuildLog\FxCop'" />
  <Message Text="##teamCity[publishArtifacts '%(CoverageResults) => BuildLog\Coverage'" />
</Target>

最后,在执行分析构建步骤后,可以使用带有 MSBuild 构建运行程序的 TeamCity 构建步骤来启动此脚本中的 msbuild 目标“PublishArtifacts”。

Because there is an asterisk (*) in the artifact source definition, there could be more than one source file grabbed by the search pattern.

To differenciate these (theoretically multiple) files in the output path, TeamCity will add the match for the * - pattern in the output structure, e.g. [...]teamcity 8681981431807223307 ncover[...]. Therefore it is impossible to select (potentially) multiple files and store them as one file.

Perhaps a different approach is the answer. You could write a MSBuild script that uses the TeamCity Build Script Interaction feature, similar to this:

<Project xmlns="http://schemas.microsoft.com/developer/msbuild/2003" 
     ToolsVersion="4.0">

<ItemGroup>
  <FxCopResults Include="%system.teamcity.build.tempDir%/fxcop-output*/fxcop-result.xml" />
  <CoverageResults Include="%system.teamcity.build.tempDir%/teamcity*ncover/CoverageReport.xml" />
</ItemGroup>

<Target Name="PublishArtifacts">
  <Message Text="##teamCity[publishArtifacts '%(FxCopResults) => BuildLog\FxCop'" />
  <Message Text="##teamCity[publishArtifacts '%(CoverageResults) => BuildLog\Coverage'" />
</Target>

Finally, a TeamCity Build Step with the MSBuild build runner could be used to start the msbuild target "PublishArtifacts" in this script after the analysis build steps were performed.

~没有更多了~
我们使用 Cookies 和其他技术来定制您的体验包括您的登录状态等。通过阅读我们的 隐私政策 了解更多相关信息。 单击 接受 或继续使用网站,即表示您同意使用 Cookies 和您的相关数据。
原文