class BradyW::MSBuild

Launches a build using MSBuild

Constants

DOTNET2_HARDCODEDPATH
DOTNET35_REGPATH
DOTNET4_REG_PATH

Attributes

compile_version[RW]

Optional .NET compilation version (what should MSBuild compile code to, NOT what version of MSBuild to use). Defaults to :v4_5). Other options are :v2_0, :v3_5, :v4_0

dotnet_bin_version[RW]

Optional Version of the MSBuild binary to use. Defaults to :v4_5 Other options are :v2_0, :v3_5, :v4_0

properties[RW]

Optional Properties to pass along to MSBuild. By default ‘Configuration’ and ‘TargetFrameworkVersion’ will be set based on the other attributes of this class.

release[RW]

Optional Do a release build? By default, this is false.

solution[RW]

Optional Solution file to build

targets[RW]

Optional Targets to build. Can be a single target or an array of targets

Private Instance Methods

debugOrRelease() click to toggle source
   # File lib/msbuild.rb
66 def debugOrRelease
67   @release ? "Release" : "Debug"
68 end
exectask() click to toggle source
   # File lib/msbuild.rb
39 def exectask
40   shell "#{path}msbuild.exe#{targets}#{propstr}#{solution}"
41 end
flatTargets() click to toggle source
   # File lib/msbuild.rb
61 def flatTargets
62   return nil unless @targets
63   @targets.is_a?(Array) ? @targets.join(",") : @targets
64 end
path() click to toggle source
   # File lib/msbuild.rb
85 def path
86   symbol = @dotnet_bin_version || :v4_5
87   case symbol
88     when :v4_0
89       dotnet DOTNET4_REG_PATH
90     when :v4_5
91       dotnet DOTNET4_REG_PATH
92     when :v3_5
93       dotnet DOTNET35_REGPATH
94     when :v2_0
95       DOTNET2_HARDCODEDPATH
96     else
97       fail "You supplied a .NET MSBuild binary version that's not supported.  Please use :v4_0, :v3_5, or :v2_0"
98   end
99 end
propsmerged() click to toggle source
   # File lib/msbuild.rb
70 def propsmerged
71   default = {}
72   default['Configuration'] = debugOrRelease
73   default['TargetFrameworkVersion'] = compile_version
74   default.merge @properties || {}
75 end
propstr() click to toggle source
   # File lib/msbuild.rb
77 def propstr
78   keyvalue = []
79   propsmerged.each do |prop, set|
80     keyvalue << "#{prop}=#{set}"
81   end
82   " /property:"+keyvalue.join(";")
83 end