Are There Any Best Practices for Writing Custom NA

2019-07-07 06:19发布

问题:

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.



标签: msbuild ant nant