Skip to content
Jonathan Gilbert edited this page Nov 15, 2019 · 2 revisions
Applies to: Albacore 1.0
In Albacore 2.0+, there is no msbuild task. The build task is more flexible and is documented here.

Simplify calling msbuild.exe to build solutions, projects, and targets files.

desc "Run a simple clean/build"
msbuild :build do |cmd|
  cmd.solution = "path/to/solution"
  cmd.targets = [:Clean, :Build]
  cmd.properties = {:Configuration => "Debug"}
end

Required Parameters

Solution

This is the solution, project, or target/tasks file that you are going to build or run a task from.

solution = "path/to/solution"

Optional Parameters

Targets

You can specify any valid target(s) as an array. The order you write them is the order they are passed to msbuild and it's in charge of execution order.

targets = [:Rebuild]

Properties

You can specify any valid MSBuild property, here, as a hash literal. The most common are configuration, platform, and outputpath, but are completely optional, so do not have built-in properties.

properties = {
  :Configuration => "Release",
  :Platform => "Any CPU",
}

Remember, these are the built-in or custom-defined msbuild properties that get passed into the /properties: parameter. This task will create one, quoted property parameter per key/value pair.

> msbuild ... /p:Configuration="Release" /p:Platform="Any CPU"

JRuby Note

When using comma separated property values in JRuby, like

properties = {:NoWarn => "0067,0105"}

it may yield an error

MSBUILD : error MSB1006: Property is not valid"

Spaces may be substituted as a workaround.

properties = {:NoWarn => "0067 0105"}

Verbosity

Sets the msbuild logging verbosity: q[uiet], m[inimal], n[ormal], d[etailed], and diag[nostic].

verbosity = :minimal

Logger Module

Sets the msbuild logger. Here is a common setting for the TeamCity msbuild logger (notice the Windows directory separator backslashes are necessary here because they're passed into the logger using Reflection).

logger_module = "JetBrains.BuildServer.MSBuildLoggers.MSBuildLogger,C:\TeamCity\buildAgent\plugins\dotnetPlugin\bin\JetBrains.BuildServer.MSBuildLoggers.dll"

No Logo

Hides the startup banner and copyright message.

no_logo

Other Switches

There are several other command line parameters that require values, like

/toolsVersion:3.5

We don't want to support all of them, and you could use the general parameters array, like this

parameters = ["/toolsVersion:3.5"]

But we also provide a hash syntax

other_switches = {:toolsVersion => 3.5}

Guidance

(none)

Clone this wiki locally