MSBuild also includes a file logger that logs build event information to a file. To run the file logger, use the following switch at the command line, where MyLog.log is the file in which to store the log information.
|
/l:FileLogger,Microsoft.Build.Engine;logfile=MyLog.log
|
In total, the file logger also accepts four parameters. These are:
Logfile: A required parameter that specifies the file in which to store the log information.
Append: An optional boolean parameter that indicates whether or not to append the log to the specified file: true to add the log to the text already present in the file; false to overwrite the contents of the file. The default is false.
Verbosity: An optional parameter that overrides the global verbosity setting for this file logger only. This enables you to log to several loggers, each with a different verbosity.
Encoding: An optional parameter that specifies the encoding for the file, for example, UTF-8.
Multiple parameters are separated with semicolons (;). For example, the following command line logs the build event information to the file MyLog.log, and appends the log to the text in the file, with diagnostic verbosity, and with UTF-8 encoding.
|
MSBuild MyProj.proj /l:FileLogger,Microsoft.Build.Engine;logfile=MyLog.log append=true;verbosity=diagnostic;encoding=utf-8
|