nant 构建失败后进行清理

发布于 2024-09-25 05:47:22 字数 381 浏览 7 评论 0原文

我正在寻找我的 nant 构建脚本,以便在构建出错时能够自行清理。我正在寻找类似于以下执行的内容:

Target= Software.Build

Target= Software.Build.Success *(depends on Software.Build succeeding)*

Target= Software.Build.Failed

我正在寻找一种解决方案,如果 Software.Build 目标失败,则将执行 Software.Build.Failed 例如,向某人发送电子邮件,告知构建以某种方式失败,否则软件.Build.Success 将运行以允许构建脚本继续。

这对南特来说可能吗?如果是这样,有人能给我指出合适的文章/解决方案吗?

I'm looking for my nant build script to be able to clean up after itself if a build goes wrong. I'm looking for something resembling the following execution:

Target= Software.Build

Target= Software.Build.Success *(depends on Software.Build succeeding)*

Target= Software.Build.Failed

I am looking for a solution that if the Software.Build target fails then Software.Build.Failed will be executed e.g. to e-mail someone that the build failed in some way, otherwise Software.Build.Success will be run to allow the build script to continue.

Is this even possible with nant? If so, could anyone point me to a suitable article/solution?

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

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

发布评论

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

评论(2

掌心的温暖 2024-10-02 05:47:22

或者,如果您有全局数据需要清理,则可以使用 NAnt OnFailure 事件。

<property name="nant.onfailure" value="failure" />
<target name="failure">
    <!-- Put your cleaning code in here -->
</target>

Or if you have global data to be cleaned up, you can use the NAnt OnFailure event.

<property name="nant.onfailure" value="failure" />
<target name="failure">
    <!-- Put your cleaning code in here -->
</target>
╭⌒浅淡时光〆 2024-10-02 05:47:22

NAntContrib 有一个 trycatch 任务

<trycatch>
  <try>
    <call target="Software.Build" />
  </try>
  <catch>
    <call target="Software.Build.Failed" />
    <fail message="build failed" />
  </catch>
  <finally>
    <!-- execute everything that doesn't depend on success or failure -->
  </finally>
</trycatch>
<call target="Software.Build.Success" />

NAntContrib has a trycatch task:

<trycatch>
  <try>
    <call target="Software.Build" />
  </try>
  <catch>
    <call target="Software.Build.Failed" />
    <fail message="build failed" />
  </catch>
  <finally>
    <!-- execute everything that doesn't depend on success or failure -->
  </finally>
</trycatch>
<call target="Software.Build.Success" />
~没有更多了~
我们使用 Cookies 和其他技术来定制您的体验包括您的登录状态等。通过阅读我们的 隐私政策 了解更多相关信息。 单击 接受 或继续使用网站,即表示您同意使用 Cookies 和您的相关数据。
原文