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

5 thoughts on “Using Eclipse & NAnt”

  1. Hey AJ, happy new year!

    Have you seen Borland’s C# Builder? They have a free version (not a demo) that isn’t bad. It’s pretty similar to Visual Studio .NET, though it’s not as polished (not too smart about indentation, missing some editing keyboard shortcuts, etc). But at least you get code completion, integrated build/debug/run, etc. I’d be curious to see how it compares with eclipse + C# plugin.

  2. I tried doing this with the free Microsoft C# compiler that comes with the free SDK download – I had trouble with the “build nant” step you link to here until I deleted all the irrelevant xml for the 1.0 framework, mono, etc. that is in nant.exe.config, leaving just the 1.1 stuff. it was complaining that 1.0 didn’t exist but after i lobotomized that part of its xml brain it built fine.

  3. Hi Friends,
    I see most of the examples with NANT is given with C#.
    However I want to know
    Can ellipse + Nant configured togather for VB.Net code?

  4. Its building but if i have a “Hello World” C# Projekt nothing happens in the console.

    NAnt 0.86 (Build 0.86.2898.0; beta1; 08.12.2007)
    Copyright (C) 2001-2007 Gerry Shaw

    Buildfile: file:///C:/Users/Username/workspace/HelloWorld/
    Target framework: Microsoft .NET Framework 2.0
    Target(s) specified: all

    Total time: 0 seconds.

    What’s wrong ?

Leave a Reply

Your email address will not be published. Required fields are marked *