Are There Any Best Practices for Writing Custom NAnt, Ant, or MSBuild tasks?

喜欢而已 提交于 2019-12-14 03:49:10

问题


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.

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.).

EDIT: 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.

Thanks


回答1:


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

MSBuild: Best Practices For Creating Reliable Builds, Part 1

MSBuild: Best Practices For Creating Reliable Builds, Part 2

Sayed Ibrahim Hashimi

My Book: Inside the Microsoft Build Engine : Using MSBuild and Team Foundation Build




回答2:


Basically you could split files and include them as reference in on file,so you can manage them better.



来源:https://stackoverflow.com/questions/882262/are-there-any-best-practices-for-writing-custom-nant-ant-or-msbuild-tasks

标签
易学教程内所有资源均来自网络或用户发布的内容,如有违反法律规定的内容欢迎反馈
该文章没有解决你所遇到的问题?点击提问,说说你的问题,让更多的人一起探讨吧!