是否有编写自定义 NAnt、Ant 或 MSBuild 任务的最佳实践? [英] Are There Any Best Practices for Writing Custom NAnt, Ant, or MSBuild tasks?

查看:30
本文介绍了是否有编写自定义 NAnt、Ant 或 MSBuild 任务的最佳实践?的处理方法,对大家解决问题具有一定的参考价值,需要的朋友们下面随着小编来一起学习吧!

问题描述

我正在为 NAnt 编写自定义任务.我一直在根据我在 Internet 上找到的一些示例以及查看 NAnt 和 Ant 的其他一些任务的来源来确定如何编写代码.

I'm in the process of writing a custom task for NAnt. I've been basing how I write the code based on some examples I've found on the Internet and by looking at the source of some other tasks for both NAnt and Ant.

话虽如此,是否有任何指导方针或最佳实践可以为构建管理器(如 NAnt、Ant 或 MSBuild)编写好的任务?我正在寻找异常处理和模块化方面的内容(即,如果我的任务对文件结构做了一些处理,我应该删除并重新创建任务的输出文件/目录或以某种方式对其进行备份等).

With that being said, are there any guidelines or best practices for writing good tasks for build managers like NAnt, Ant, or MSBuild? I'm looking for such in terms of exception handling and modularity (i.e. if my task does something with the file structure should I delete and recreate the output file/directory of my task or back it up somehow, etc.).

我正在寻找有关自定义任务创建的指南.如果我想为 NUnit 或 Selenium 创建自己的任务或编译 F#(我知道它们已经存在,但只是说这些任务不在大多数构建管理器的原始核心中),那么编写自己的任务有哪些最佳实践?.我对构建文件没有问题.只是查看编写新编译任务的指南.

I'm looking for guidelines on custom task creation. If I wanted to create my own task for NUnit or Selenium or to compile F# (I know they already exists but just saying that these are tasks not in the original core of most build managers), what are some best practices on writing my own task. I have no issues with build files. Just looking at guidance for writing new compiled tasks.

谢谢

推荐答案

对于 MSBuild,我写了 2 篇文章,可能对您有所帮助.

For MSBuild I have written 2 articles that may help you.

MSBuild:创建可靠构建的最佳实践,第 1 部分

MSBuild:创建可靠构建的最佳实践,第 2 部分

赛义德·易卜拉欣·哈希米

Sayed Ibrahim Hashimi

我的书:微软构建引擎内部:使用 MSBuild和团队基础构建

这篇关于是否有编写自定义 NAnt、Ant 或 MSBuild 任务的最佳实践?的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持IT屋!

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