Skip to content
haf edited this page Nov 29, 2014 · 10 revisions

The build command replaces the msbuild command from previous versions of Albacore.

require 'albacore'
build :compile_this do |b|
  b.file   = Paths.join 'src', 'MyProj.fsproj' # the file that you want to build
  # b.sln  = Paths.join 'src', 'MyProj.sln'    # alt. name
  b.target = ['Clean', 'Rebuild']              # call with an array of targets or just a single target
  b.prop 'Configuration', 'Release'            # call with 'key, value', to specify a MsBuild property
  b.cores = 4                                  # no of cores to build with, defaults to the number of cores on your machine
  b.clp 'ShowEventId'                          # any parameters you want to pass to the console logger of MsBuild
  b.logging = 'detailed'                       # detailed logging mode. The available verbosity levels are: q[uiet], m[inimal], n[ormal], d[etailed], and diag[nostic]
  # b.be_quiet                                 # opposite of the above
  b.nologo                                     # no Microsoft/XBuild header output
end

If you want the build command to package the solution for web deployment, add the following properties:

b.prop 'UseWPP_CopyWebApplication', 'true' # applies the web.config transforms for the build config
b.prop 'PipelineDependsOnBuild', 'false' # makes it so you can package without building first
b.prop 'webprojectoutputdir', '../deploy/' # the directory to write the published files to
b.prop 'outdir', 'bin/' # the directory of your bin files for the project

Even more on #prop

So for example, if you're migrating from v1.0 and your configuration looks like this

msbuild :clean => [logs] do |msb|
  ...
  msb.other_switches = {:fl => true, :flp => "LogFile=#{logs}/clean.log;Verbosity=Detailed;PerformanceSummary", :nr => false}
end

You can write it like:

build :clean => 'logs' do |msb|
  msb.prop 'flp', "LogFile=#{File.join(logs, 'clean.log')};Verbosity=Detailed;PerformanceSummary"
  msb.prop 'fl', 'true'
  msb.prop 'nr', 'false'
end

Furthermore, this configuration includes CmdConfig which lets you set arbitrary parameters to pass to commands:

msb.add_parameter "/mycustom:oh-yeah"
Clone this wiki locally