Gordon Weakliem wrote:

This is a nice start on the FAQ. One alternate answer to "I've written a custom task, and it won't load" is to make sure you've got the [TaskName] attribute on your class. There's also some residual confusion over the <taskdef> task, there seems to be a post on that every few weeks.
OK I've added:

"I've written a custom task, and it won't load" - whats wrong ?
ensure that your assembly is named somthing like XXXTasks.dll and that it is placed in the same directory as NAnt or in a subdirectory named tasks.
make sure you've got the [TaskName] attribute on your class
make sure that your [TaskAttribute] attributes are attached to public properties with set methods.

What is/what happened to <taskdef> ?
<taskdef> was a task that was originally migrated from Ant. It allowed you to in effect import a task by specifying the assembly and task class name from the build file. This mechanism has been deprecated in favor of having nant find all tasks in all assemblies in certain directories. If you really want to use taskdef it can be found in NAntContrib.

and I just thought of another one :

How do I reference Environment Variables from Nant ?
NAnt has a sysinfo task which will inject the set of env vars and some other system properties into the properties collection under the sys.env namespace. You can then reference then the same way as any other properties. So you would access the path with ${sys.env.path}. See the sysinfo task help for more info.

I've got one small correction, though, my name's spelled Weakliem :-)
Doh ! Sorry about that.

Ian

Ian MacLean wrote:

After realizing that there was no FAQ and observing lots of the same questions cropping up on the lists recently I've put together a first draft of an FAQ. Thanks to Brian Deacon for putting the first 2 faq questions up on the wiki. This is just a first stab at it after a quick skim thru the list archives. Please respond with comments and additions. I know I could have just added it to the wiki but I figure It will get seen by more eyes here. So here goes ...


NAnt FAQ ( first draft )

What is Nant ?

NAnt is a free .NET build tool. In theory it is kind of like make without make's wrinkles. In practice it's a lot like Ant.

Why not use makefiles ?
neater syntax
easier tool integration thru the use of xml
portability - will run whereever a .Net framework is present.
specific support for .Net compilers and tools
filesets and other grooviness

What are the benefits/Advantages of NAnt ?
Here is a list from some NAnt users.
Use Nant if you need to :
- Kick off calls to external processes (such as
email, the file system, or an automated unit testing
system like NUnit)
- Kick off your build from a centrally-managed
location (i.e., a server) so the "one true" version of
your build resides in one and only one location
- Build your software on any machine regardless of
the presence of Visual Studio .NET
- build multiple versions/flavors of your product
- You have a large number of inter-dependant projects (assemblies) to
build.
- build multiple source language projects (like 2 vb.net, 2
managed c++, and hand-full of c#) and zip them up.
- build a signed and unsigned version together
- scp files up to another server
- perform additional logic in your build process
- do unit testing before you call a build good. :)
- run a custom program to generate some of your code and you
want to validate it first.
- download a file from the internet to do your build.

Why not use Ant ?
JDK dependencies
specific .Net features like Attributes
specific support for .Net sdk tools and compilers
cleaner code thru use of attributes and reflection.
we just wanted to do build our own.
Which release should I be using
The stable release ( 0.8.0 *once its out* ) if stability and robustness is what you're after. If you're after the most up to date version try one of the nightly builds although be aware that these are not intended to be release quality.
I've heard about task X - where can I find it
If it not in the core nant distibution changes are its in NAntContrib - see next question

what/where is NAntContrib ?
NAntContrib is a seperate project for extra tasks and extra tools that haven't made it into the core NAnt distribution. The idea is that its easier to get code added to NAnt contrib. It is likely that some tasks will migrate across into NAnt itself as they become more used. The NAntContri project is located at http://sourceforge.net/projects/nantcontrib
How do I incorporate NAntContrib into NAnt?

A: Build it and place the assembly in the same dir as the main nant executable.

I can't find any documentation for task X - where is it ?
userdoc is created as part of the build process. If the doc in the version you downloaded is out of date you can always run the userdoc target in Nants buildfile
How do I use NAnt from Visual Studio.Net ??
You can add Nant to the external tools menu. Or use the NAnt Addin - which is part of the NAntContrib project.

How do I call/convert visual studio projects from NAnt ?
you can use the SLingshot tool or use Gordons wealkins xsl transform to convert you .csproj files. (http://radio.weblogs.com/0106046/stories/2002/08/10/supportingVsnetAndNant.html)
what/where is slingshot ?
Slingshot is a project for converting vs.net solutions to NAnt build files. It is currently part of the NAntContrib project.

How do/can I build c++ projects with nant ?
see the Visual C++ tasks and John Lam's docs

Does nant have source control tasks ?
Yes there are Visual sourcesafe tasks and hopefully there will soon be cvs tasks. See also Draco.Net


NAnt doesn't have task X - I need that for my current development work
Patches are always welcome :) or ping the dev list someone may already be working on it.
How do I contribute to NAnt/NAntContrib ?
Read the Coding conventions ( http://sourceforge.net/docman/display_doc.php?docid=6080&group_id=31650 )
Grab the source
Send patches to the developer lists. Its that easy.
Or do the same for doc - lots of work need there too.
How do I create my own tasks ?
post to the list to see if someone is already working on a similar task.
Use the Attrib task as reference ( we could do with a "building your first task" tutorial
flesh it out
post to the developer list for review.

Now that I've created my own tasks how do I get Nant to find them ?
ensure that your assembly is named somthing like XXXTasks.dll and that it is placed in the same directory as NAnt or in a subdirectory named tasks

How can I target multiple framework versions with NAnt ?
Feature coming soon.
Are there any guidelines/best practices for using NAnt ?
not right now but hopefully soon Does NAnt work with mono ?
kinda but needs some work and dedicated testing - particularly on a linux machine. Mono uses a very old version of nant to build their class libraries.






-------------------------------------------------------
This sf.net email is sponsored by:ThinkGeek
Welcome to geek heaven.
http://thinkgeek.com/sf
_______________________________________________
Nant-developers mailing list
[EMAIL PROTECTED]
https://lists.sourceforge.net/lists/listinfo/nant-developers



-------------------------------------------------------
This sf.net email is sponsored by:ThinkGeek
Welcome to geek heaven.
http://thinkgeek.com/sf
_______________________________________________
Nant-developers mailing list
[EMAIL PROTECTED]
https://lists.sourceforge.net/lists/listinfo/nant-developers

Reply via email to