Using Eclipse & NAnt

I’ve been using the Eclipse and NAnt together to write C#/ASP.NET apps for the last couple months, they’re relatively easy to get working together, but I thought I’d write it up for those who aren’t having such an easy time.

1) DownloadEclipse and NAnt from their respective download sites and install/unzip (you have to build nant). I’m also using the C# Improv plugin, which you can download here.

2) Create your project in Eclipse (not a Java project, use a Simple Project) and then create your XML build file and name it {your_project}.build. You can see a sample build file here.

3) With Eclipse open, click ‘Run –> External Tools –> External Tools’. You should see something like this:

Eclipse NAnt Integration

4) Give this instance of the external tool a name, I use something like ‘NAnt — My Project’. Enter the location of the NAnt executable (which should exist wherever you unzipped it too, something like C:\nant-0.8.3\nant-0.8.3.50105\bin\NAnt.exe). Finally, enter the working directory by clicking the ‘Browse Workspace’ button and selecting the appropriate project from the list of projects. Click the Run button at the bottom of the page and you should see the results of NAnt being displayed in the Eclipse Console.

To run the build process now, you simply click Run –> External Tools –> NAnt — My Project (where NAnt — My Project is the name you gave to this instance in step 4).