Join GitHub today
GitHub is home to over 28 million developers working together to host and review code, manage projects, and build software together.Sign up
Commandline Task Options
Many of the tasks that Albacore includes are wrappers around command line tools. For example, the MSBuild task, NUnit task, and NCoverConsole tasks are all set up to call out to a command line tool. These commandline tasks have a few common options that allow you to control how the command line is called.
All command line tasks provide a
.command attribute to specify the location of the tool to be executed. The tool can be any arbitrary command line tool, including built-in system commands.
nunit :test do |nunit| nunit.command = "tool/nunit-console.exe" #... other options here end
In order to make these tasks more flexible and capable of running with options that are not yet supported by the task configuration, directly, we have added a generic
.parameters attribute to all tasks that run a command line tool. This will allows you to use any arbitrary parameters that you want, when calling the task. For example:
msbuild :build do |msb| #... other options here msb.parameters "i'm a parameter!", "/some:value", "/whatever=idontknow" end
There are times when the tool that is being called needs to be executed from a specific working directory. For example, NUnit may need to be called from a certain working directory, so that it can correctly find all of the necessary assemblies. In cases like this, you can set the working directory of the commandline task.
nunit :unittests do |nunit| nunit.working_directory = "src/tests/bin/release/" #note: the .command is relative to the working directory nunit.command = "tool/nunit-console.exe" #note: for the NUnit task, the path to the assemblies #is also relative to the working directory nunit.assemblies "tests.dll" end
Note that the
.command setting is relative to the working directory. If you change the working directory, then you must specify the location of the command that is being executed, relative to the working directory.
Only the current task call will be executed in the specified working directory. In the above example, the working directory will be reset after the NUnit command is executed.