A Bau plugin for running MSBuild files.
> scriptcs -install Bau.MSBuild -pre
// execute the default version of MSBuild using default arguments and switches
bau.MSBuild("build");
// execute a specific version of MSBuild using custom arguments and switches
bau.MSBuild("build").Do(msb =>
{
msb.MSBuildVersion = "net45";
msb.MSBuildArchitecture = ProcessorArchitecture.X86;
msb.Solution = solution;
msb.Targets = new[] { "Clean", "Build", };
msb.Properties = new { Configuration = "Release" };
});
-
MSBuildVersion
string
: The version of MSBuild to use. Defaults tovs12
. For a version which ships with Visual Studio 2013 or later, you can use a Visual Studio identifier, e.g. for Visual Studio 2013, usevs12
orvs2013
. For older versions which shipped with .NET framework releases, use a NuGet style framework identifier, e.g.net45
. -
MSBuildArchitecture System.Reflection.ProcessorArchitecture: Controls whether the 64-bit or 32-bit version of MSBuild is used. The default (
None
/MSIL
) is the version matching the current OS.IA64
andArm
are not supported. -
WorkingDirectory
string
-
Solution a.k.a ProjectFile
string
: The solution or project to build. If not set, the default MSBuild behaviour occurs (see MSBuild Command-Line Reference).
The following properties map directly to MSBuild command line switches. The documentation for each switch is not repeated here. For non-trivial mappings, an explanation is provided.
-
Help
bool
-
DetailedSummary
bool
-
IgnoreProjectExtensions
IEnumerable<string>
-
MaxCpuCount
int?
: For unlimited CPU usage, set this to-1
orint.MaxValue
. -
NoAutoResponse
bool
-
NodeReuse
bool?
-
NoLogo
bool
-
Preprocess
string
: To pass the switch with no argument, set this to""
orstring.Empty
. -
Properties
object
: Set this to an instance of an anonymous type. E.g.new { Configuration = "Release", WarningLevel = 2, }
will be rendered as the command line switches"/property:Configuration=Release /property:WarningLevel=2"
. -
Targets
IEnumerable<string>
-
ToolsVersion
string
-
Validate
string
: To pass the switch with no argument, set this to""
orstring.Empty
. -
Verbosity
Verbosity
:Normal
(default),Quiet
,Minimal
,Detailed
,Diagnostic
. -
Version
bool
-
ResponseFile a.k.a @
string
-
ConsoleLoggerParameters
ConsoleLoggerParameters
: all properties are of typebool
with the exception of Verbosity which is of typeVerbosity
(see above). -
DistributedFileLogger
bool
-
DistributedLoggers
IList<DistributedLogger>
:DistributedLogger
has a CentralLoggerLogger
and ForwardingLoggerLogger
. -
FileLoggers
IList<FileLogger>
:FileLogger
has a Numberint
and a FileLoggerParametersFileLoggerParameters
. -
Loggers
IList<Logger>
-
NoConsoleLogger
bool
- Args
string
: This can be used to pass undocumented switches or is sometimes useful as a terse alternative to setting the properties described above. The value of Args is appended to the string rendered by any properties which have been set.