-
Notifications
You must be signed in to change notification settings - Fork 0
NAnt Task
To simplify the calling of a nant.exe, the NAntTask can be used in a rakefile. Be sure to require ‘albacore’ at the top of your rakefile, after installing the Albacore gem.
Here is an example of how to use the NAntTask
desc "Run a sample build using the NAntTask"
nant :full_build do |nant|
nant.command = "bin/tools/nant/nant.exe"
nant.build_file = "src/TestSolution/TestSolution.build"
nant.properties :debug => true, "build.mode" => :fast
nant.targets :Clean, :Build, :Specs
end
You must specify any name you wish to identify this rake task.
You must specify the location of the nant.exe that you wish to use.
If an invalid or incorrect nant path is specified (i.e. if the file or folder specified does not exist), the NAntTask will fail with an exception stating that the nant file was not found:
F, [2009-10-04T14:01:33.481000 #5436] FATAL -- : Command not found: i don't exist.exe
F, [2009-10-04T14:01:33.481000 #5436] FATAL -- : Nant task Failed. See Build Log For Detail
rake aborted!
This is the nant build file that specifies the target(s) you want to run. If you don’t provide a valid nant build file, nant will try to use the first *.build file it finds in the current directory.
If no build file can be found, the NAntTask will fail with an error stating that a build file could not be found.
You can specify any valid NAnt command line property as a hash literal. For example, if you wanted to provide a property called “foo” with a value of “bar”, and a property called “widget” with a value of “wombat”, you would do so like this:
msb.properties :foo => :bar, :widget => :wombatYou are not required to use :symbols for these values. You can provide string values if you wish.
The properties setting is optional. If you don’t provide any values for this, the defaults from your NAnt build file will be used.
You can specify any valid target for your NAnt build file as an array. The example above is calling the Clean, Build and then Specs targets, in that order. If you only want to call Rebuild, as another example, you would set the targets like this:
nant.targets :RebuildYou are not required to use :symbols for these values. You can provide string values if you wish. However, if you try to use data types such as “true” or “false”, you must specify them as symbols or strings, directly.
The properties setting is optional. If you don’t provide any values for this, the defaults from your NAnt build file will be used.
The NAntTask uses the built in logging options to provide some potentially useful information at run-time. By default, no additional information is logged, other than what NAnt produces.
When the log_level is set to :verbose, the full command line call for NAnt will be logged. This includes the expanded path to the nant exe as well as the command line parameters that are passed to it.
D, [2009-09-28T09:18:22.254000 #7152] DEBUG -- : Executing NAnt: "bin/tools/nant/nant.exe" "src/TestSolution/TestSolution.build" -D:debug=true -D:build.mode:fast Clean Build
This task supports configuration via an external YAML file. For more information, see the yamlconfig page.
This task supports additional command line options, including a .parameters collection for passing in options that are not directly supported. For more information, see the commandline task options documentation.
- Build-Server Integration
- Command Line Task Options
- Configuration
- Custom Tasks
- Logging Options
- Sample Usages
- Task Arguments and Rakefile Parameters
- YAML Configuration
- ASP.NET Compiler - ASP.Net website compiler
- Assembly Info Generator - generate assembly info dynamically
- CSC - C# compiler
- Exec - Execute arbitrary cmd
- Fluent Migrator - Run FluentMigrator on migration library
- ILMerge - Merge dll/exe-s together
- MSBuild and XBuild - Compile a .sln-file or a MsBuild xml-file
- MSpec - Test using MSpec (machine.specifications)
- MSTest - Test using Microsoft Test Framework
- NAnt - Run a NAnt script
- NChurn - Calculate per-file churn
- NCover Console - Run NCover for tests/library
- NCover Reports - Generate a report from a coverage run
- NDepend - Run NDepend to check static code metrics
- NuGet Install - Install NuGet packages
- NuGet Pack - Create NuGet packages
- NuGet Push - Push NuGet packages to official MS repo
- NuGet Publish - Publish NuGet packages
- NUnit - Test using NUnit
- NuSpec - Generate a NuSpec file
- Output - File copying and template expansion
- PLink - SSH into a remote computer and run a command
- SQLCmd - Run a SQL command as a part of your build process
- UnZip - Unzip a directory
- XBuild - Run XBuild (will be merged into MsBuild)
- XUnit - Test using XUnit
- Zip - Zip a directory or files
- Edit the Wiki Locally - How to edit the wiki without using Github's interface
- How to Build Albacore
- How to Contribute