Skip to main content

MSBuild CLI

warning

This document has been translated using machine translation without human review.

warning

Using dotnet is preferable to msbuild in most cases.

How to run msbuild?

The easiest way is to use Developer Command Prompt for Visual Studio.

How to build a project/solution?

Building a solution with msbuild
msbuild MySolution.sln
Building a project with msbuild
msbuild MyProject.csproj

How to specify configuration when building a project/solution?

msbuild MyProject.csproj /property:Configuration=Release /property:Platform=x64

How to execute a target task?

You can specify the target name using the /target: (/t:) parameter. If you need to execute multiple targets, you can specify them separated by commas.

msbuild MyProject.csproj /target:Clean,Build

How to enable detailed output during build?

msbuild MyProject.csproj /verbosity:diagnostic
msbuild MyProject.csproj /v:diag

Possible values:

  • quiet (q)
  • normal (n)
  • minimal (m)
  • detailed (d)
  • diagnostic (diag)