-
Notifications
You must be signed in to change notification settings - Fork 63
MSBuild
| 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"}
endThis is the solution, project, or target/tasks file that you are going to build or run a task from.
solution = "path/to/solution"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]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"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"}Sets the msbuild logging verbosity: q[uiet], m[inimal], n[ormal], d[etailed], and diag[nostic].
verbosity = :minimalSets 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"Hides the startup banner and copyright message.
no_logoThere are several other command line parameters that require values, like
/toolsVersion:3.5We 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}(none)