如何在Nant构建脚本中进行错误处理? [英] How to do error handling in nant build scripts?

查看:118
本文介绍了如何在Nant构建脚本中进行错误处理?的处理方法,对大家解决问题具有一定的参考价值,需要的朋友们下面随着小编来一起学习吧!

问题描述

我正在编写一个NAnt构建脚本,该脚本负责将一些文件部署到iss服务器.作为此操作的一部分,我想在脚本中添加错误处理-这是我以前从未使用过的.

I am writing a NAnt build script which is responsible for deploying some files to an iss server. As part of this I would like to add error handling to my scripts - something which I haven't used before.

引入错误处理不可避免地导致对构建文件结构的思考.我认为结构是目标中的逻辑分组以及它们之间的依赖关系.

Introducing error handling inevitably leads to thoughts about the structure of the build file (s). I think of structure as the grouping of logic in targets and the dependencies between these.

在NAntContrib中,我发现了比标准"onfailure"属性更容易完成的任务.不幸的是(至少对我来说),它只有简短而相当简单的用法示例,才是可能的.我需要的是有关如何使整个文件结构能够处理更复杂情况下的错误的建议.

In NAntContrib I have found the task which should make the job easier than the standard "onfailure" property. Unfortunately its only possible (at least for me) to find short and fairly simple examples of its usage. What I need is recommendations on how to make an entire file structure that handles errors for the more complex scenarios.

推荐答案

如何使用try/catch块代替任何易碎的代码?

How about using the try/catch blocks instead around any fragile code?

http://nantcontrib.sourceforge.net/release/0.85 /help/tasks/trycatch.html

这篇关于如何在Nant构建脚本中进行错误处理?的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持IT屋!

查看全文
登录 关闭
扫码关注1秒登录
发送“验证码”获取 | 15天全站免登陆