SharpDevelop Community

Get your problems solved!
Welcome to SharpDevelop Community Sign in | Join | Help
in Search

Matt Ward

NAnt Integration

Support for NAnt has been added to SharpDevelop 2.0. in revision 573.

Changes from SharpDevelop 1.1

There are a few things missing from the NAnt addin compared to the previous version that shipped with SharpDevelop 1.1.

The "Create Build File" menu option has been removed.  SharpDevelop now uses MSBuild project files instead of SharpDevelop projects (.prjx) and there is currently no conversion code written.  The original code took the project file and ran an XSL transform on it to produce the NAnt build file.  This feature will be added at a later date.

NAnt no longer ships with SharpDevelop.  This means that NAnt needs to be installed separately.  By default SharpDevelop assumes that the NAnt executable is accessible by the Path environment variable.  If this not the case the NAnt executable to use can be set via Tools | Options | Tools | NAnt | Command.  If you install one of the NAnt nightly builds  you will be able to target .NET Framework 2.0 Beta 2.

By default SharpDevelop supports NAnt 0.85 RC3, previously the 0.84 schema was the default.

Issues

The first time SharpDevelop is run the NAnt pad may not display any contents.  To fix this you
will need to restart SharpDevelop.  There seems to be an issue with the default layout information.

Creating a new NAnt build file

To add a new build file to your project:
  1. Open the project browser, View | Projects.
  2. Right click the project and select Add | Add New Item...
  3. In the "New File" dialog, select the Misc category.
  4. Choose the "NAnt Build File" template, specify a file name and click the "Create" button.



Xml auto-completion, based on the NAnt 0.85 RC3 schema, will occur whilst you are editing the NAnt build.



Project Menu



Run Default Target Runs the default target of the build file for the project.  The build file must be part
of the project (i.e. it exists in the project view).
Run Clean Target Runs the "clean" target of the build file for the project.
There is currently no clever add-in logic here, in order for this menu option to work there needs to be a target called "clean".
Stop NAnt Stops a currently running build.  A warning message is displayed.  This option kills the NAnt process.


Project Browser

NAnt ".build" and ".include" files are displayed in the project browser with their own icon.



NAnt Pad

To open the NAnt pad, select View | Tools | NAnt.



The NAnt Pad displays all the build files in the solution.  It gives a high level overview of the build file, showing all the build targets.

Double clicking a target node will open up the build file and move the cursor to the corresponding <target> element.

The NAnt pad's toolbar buttons, from left to right:

Run If the build file node is selected, runs the default target.
If a target node is selected, runs that target.
Refresh Refreshes the tree.  Reads the build file again and updates the display.
Stop Stops the currently running build.

The NAnt pad has a text box at the bottom where the user can specify extra command line options.  In the screenshot below the user has entered "-targetframework:net-1.1", this will be added to the NAnt command line.

NAnt Pad Context Menu

Right clicking the build file node shows the context menu:



The Open menu option will open the build file into the SharpDevelop text editor.

The other menu options have been described in the "Project Menu" section.

Right clicking on a target node shows the context menu:



Run Target Runs the target selected.  This passes the target's name to NAnt on the command line.
Open Opens the build file into the SharpDevelop's text editor.
Goto Definition Opens up the build file and moves the mouse cursor to the corresponding <target> element.

Output Window

All NAnt output is shown in a NAnt output window.



The first two lines are outputted by the NAnt add-in showing the NAnt command line used.  The rest is the output from NAnt.

Errors Window

Errors and warnings from the NAnt build are displayed in the Errors window.



  NAnt Configuration

Open the NAnt options panel via Tools | Options | Tools | NAnt 



Panel Option Description
Command The location of the NAnt executable to use.
Arguments Standard arguments that will be passed to NAnt (e.g. -targetframework:net-1.1).
Quiet Maps to NAnt's -quiet command line option.
Show Logo Shows/hides the NAnt logo in the output window.
Verbose Maps to NAnt's -verbose command line option.
Debug Maps to NAnt's -debug command line option.
Published Oct 15 2005, 07:36 PM by MattWard
Filed under:

Comments

No Comments
Powered by Community Server (Commercial Edition), by Telligent Systems
Don't contact us via this (fleischfalle@alphasierrapapa.com) email address.