-
Notifications
You must be signed in to change notification settings - Fork 64
build
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
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
then, this configuration object (msb
) includes CmdConfig
which lets you set arbitrary parameters to pass to commands:
build :clean => 'logs' do |msb|
msb.add_parameter "/flp:LogFile=#{File.join(logs, 'clean.log')};Verbosity=Detailed;PerformanceSummary"
msb.add_parameter '/fl:true'
msb.add_parameter '/nr:false'
end
The code is also very readable and well documented: https://github.com/Albacore/albacore/blob/master/lib/albacore/task_types/build.rb#L57