【问题标题】:How to display msbuild errors on the overview page from TeamCity如何在 TeamCity 的概览页面上显示 msbuild 错误
【发布时间】:2013-05-10 08:32:59
【问题描述】:

我想将 PowerShell 与 Psake 和 TeamCity 一起使用来配置我的 CI。我曾经使用标准的 Msbuild runner,但现在我编写了自己的脚本来构建解决方案,但是当 msbuild 失败时我遇到了问题。

当我使用 Msbuild runner 并且构建失败时,在概述页面上会出现新的“构建错误”部分,并且我有来自 msbuild 的详细信息。但是当我编写自定义脚本时,我只收到错误“进程退出,代码 1”,我不知道如何“创建”这个构建错误部分。你知道怎么做吗?我知道我可以使用service messages,但我无法处理来自 msbuild 的失败日志。

task compile {
try {
   exec { msbuild $code_dir\SampleSolution.sln /t:Build /p:Configuration=Release }
} catch {
   Write-Host $_ #only information that error occured, but without any msbui details
} }

【问题讨论】:

  • 您是否有权访问构建日志文件?
  • Msbuild 构建日志 - 是的
  • 这里有一个很好的解决方案:link

标签: powershell psake teamcity-7.1


【解决方案1】:

你可以指定log for MSBuild

从日志中解析错误或将整个日志附加为构建工件。

##teamcity[publishArtifacts '.\msbuild.log']

要使构建失败,您可以使用以下消息

Write-Output "##teamcity[message text='MS Build failed' status='ERROR']"

你可以得到所有可以使用的消息here

【讨论】:

    猜你喜欢
    • 2018-03-13
    • 1970-01-01
    • 1970-01-01
    • 1970-01-01
    • 1970-01-01
    • 2011-12-29
    • 1970-01-01
    • 1970-01-01
    • 2014-07-25
    相关资源
    最近更新 更多