Friday, 14 June 2013

Posted by Prasad KM | 10:38 Categories:

Msbuild Command Line

Argument
Description
ProjectFile
Builds the specified targets in the project file. If a project file is not specified, MSBuild searches the current working directory for a file name extension that ends in "proj" and uses that file. This argument also accepts Visual Studio 2005 solution files
Switch
Description
/help
Displays usage information. /? or /h are also acceptable. For example:
Msbuild.exe /?
/nologo
Hides the startup banner and copyright message.
/version
Displays version information only. /ver is also acceptable.
@file
Inserts command line settings from a text file. Specify each response file separately. For more information, see MSBuild Response Files.
/noautoresponse
Does not auto-include the MSBuild.rsp file. /noautorsp is also acceptable.
/target:targets
Builds these targets in this project. Use a semicolon or a comma to separate multiple targets, or specify each target separately. /t is also acceptable. For example:
/target:Resources;Compile
/property:name=value
Sets or overrides these project-level properties, where name is the property name and value is the property value. Use a semicolon or a comma to separate multiple properties, or specify each property separately. /p is also acceptable. For example:
/property:WarningLevel=2;OutputDir=bin\Debug
/logger:logger
Specifies the logger to use to log events from MSBuild. To specify multiple loggers, specify each logger separately.
The logger syntax is:
[LoggerClass,]LoggerAssembly[;LoggerParameters]
The LoggerClass syntax is:
[PartialOrFullNamespace.]LoggerClassName
Note:
You do not have to specify the logger class if there is exactly one logger in the assembly.
The LoggerAssembly syntax is:
{AssemblyName[,StrongName] | AssemblyFile}
Logger parameters are optional and are passed to the logger exactly as you type them. For example:
/logger:XMLLogger,C:\Loggers\MyLogger.dll;OutputAsHTML
/distributedlogger:<central logger>*<forwarding logger>
Use this logger to log events from MSBuild. To specify multiple loggers, specify each logger separately. (Short form /dl)
The <logger> syntax is:
[<logger class>,]<logger assembly>[;<logger parameters>]
The <logger class> syntax is:
[<partial or full namespace>.]<logger class name>
The <logger assembly> syntax is: {<assembly name>[,<strong name>] | <assembly file>}
The <logger parameters> are optional, and are passed to the logger exactly as you typed them. (Short form: /l)
Examples: /dl:XMLLogger,MyLogger,Version=1.0.2,Culture=neutral
/dl:MyLogger,C:\My.dll*ForwardingLogger,C:\Logger.dll
/consoleloggerparameters:parameters
Specifies the parameters to pass to the console logger. /clp is also acceptable. The available parameters are as follows:
  • PerformanceSummary: Displays the time spent in tasks, targets, and projects.
  • NoSummary: Hides the error and warning summary displayed at the end of a build.
  • NoItemAndPropertyList: Hides the list of items and properties displayed at the start of each project build in diagnosticverbosity.
/verbosity:level
Displays this amount of information in the build log. Individual loggers display events based upon the verbosity level. A logger can also be configured to ignore the verbosity setting.
The available verbosity levels are q[uiet]m[inimal]n[ormal],d[etailed], and diag[nostic]. /v is also acceptable. For example:
/verbosity:quiet
/noconsolelogger
Disables the default console logger and does not log events to the console. /noconlog is also acceptable.
/validate:schema
Validates the project file and, if validation succeeds, builds the project.
If schema is not specified, validates the project against the default schema.
If schema is specified, validates the project against the specified schema.
/maxcpucount:number
Specifies the number of worker processes that are involved in the build. For example: C:\Windows\WinFX\v3.5>msbuild.exe *.proj /maxcpucount:3. This example instructs MSBuild to build using three MSBuild.exe processes, thus allowing three projects to build in parallel. /m is also acceptable.
/ignoreprojectextensions:<extensions>
List of extensions to ignore when the project file to build is being determined. Use a semicolon or a comma to separate multiple extensions. (Short form: /ignore) Example:/ignoreprojectextensions:.vcproj,.sln
/fileLogger
Logs the build output to a single file ("msbuild.log") in the current directory. The location of the file and other parameters for the fileLogger can be specified through the addition of the "/fileLoggerParameters" switch. (Short form: /fl)
/distributedFileLogger
Logs the build output to multiple log files, one log file per MSBuild node. The initial location for these files is the current directory. By default the files are called "MSBuild<nodeid>.log". The location of the files and other parameters for the fileLogger can be specified with the addition of the "/fileLoggerParameters" switch.
If a log file name is set through the fileLoggerParameters switch the distributed logger will use the fileName as a template and append the node id to this fileName to create a log file for each node.
/fileloggerparameters:<parameters>
Specifies the parameters for the file logger and distributed file logger. (Short form: /flp)
The available parameters are:
LogFile - The path to the log file into which the build log is written. The distributed file logger uses this as a prefix for its log file names.
Append - Determines if the build log is appended to or overwrite the log file. When you set the switch, the build log is appended to the log file. When you do not set the switch, the contents of an existing log file are overwritten. The default is not to append to the log file.
Verbosity - Overrides the default verbosity setting of detailed.
Encoding - specifies the encoding for the file, for example, UTF-8.
Any of the console logger parameters can also be used. For example:/fileLoggerParameters:LogFile=MyLog.log;Append; Verbosity=diagnostic;Encoding=UTF-8
/toolsversion:version
Specifies the version of the Toolset to use to build the project. This command lets you build a project by using a version different from that specified in the Project Element (MSBuild). For example:
C:\Windows\WinFX\v3.5>msbuild.exe *.proj /ToolsVersion:3.5 /p:Configuration=Debug
Valid values for version are as follows: 2.0, 3.0, and 3.5. For more information about Toolsets, see Building for Specific .NET Framework Versions.
/nodeReuse:<parameters>
Enables or Disables the re-use of MSBuild nodes. The parameters are:
True - Nodes remain after the build completes and are reused by subsequent builds.
False - Nodes do not remain after the build completes. (Short form: /nr) Example: /nr:true
To pass parameters to the default console logger, first disable it with /noconsolelogger and then specify it with the /logger syntax. For example, use the following command line to show the performance summary ordinarily only displayed in diagnostic verbosity:
msbuild myproject.csproj /noconsolelogger /l:ConsoleLogger,Microsoft.Build.Engine.dll;performancesummary
Example
The following example builds the rebuild target of the MyProject.proj project.
MSBuild.exe MyProject.proj /t:rebuild
You can use MSBuild.exe to perform more complex builds. For example, you can use it to build specific targets of specific projects in a solution. The following example rebuilds the project NotInSolutionFolder, and cleans the project InSolutionFolder, which is in the NewFolder solution folder.
msbuild SlnFolders.sln /t:NotInSolutionfolder:Rebuild;NewFolder\InSolutionFolder:Clea

0 comments:

  • RSS
  • Delicious
  • Digg
  • Facebook
  • Twitter
  • Linkedin
  • Youtube