MSBuild
|
This section documents MSBuild 18.9, the .NET SDK 10.0.402 (with its This content was generated with the assistance of AI and should be verified against the official documentation before being relied on in production. The C# Reference bibliography lists the reference material consulted while preparing these pages. |
MSBuild is the build engine of .NET: it reads XML project files, evaluates their properties and items, and runs
targets made of tasks. Everything the .NET SDK does at build time — restore, compile, copy, pack, publish — is
MSBuild logic shipped in .props and .targets files, and the same engine builds C++ and other Visual Studio project
types. It is open source (dotnet/msbuild, MIT licence) and ships in three places:
inside Visual Studio and the Build Tools for Visual Studio (msbuild.exe, .NET Framework, Windows), and inside
every .NET SDK (dotnet msbuild, .NET, all platforms). This group documents MSBuild 18.9.15, the version in
.NET SDK 10.0.402; Visual Studio 2026 18.11.1 carries 18.11, and the .NET 11 release candidates carry 18.12 (preview).
The introduction to MSBuild in the C# Reference is
Build and Tooling — MSBuild.
Three ways to run it
| Command | What it is |
|---|---|
|
The .NET Framework MSBuild installed with Visual Studio or the Build Tools (Windows only). What Visual Studio itself uses; can load tasks built for .NET Framework and, since Visual Studio 2026 / .NET 10, tasks built for .NET through the .NET task host. Not run here. |
|
The .NET MSBuild inside the selected SDK. The CLI adds |
|
The CLI’s front ends: they call the same in-process MSBuild with added defaults ( |
A five-line project with one target is a complete MSBuild project — no SDK, no compiler:
<Project>
<PropertyGroup>
<Ledger>Ledgerline</Ledger>
</PropertyGroup>
<Target Name="Hello">
<Message Importance="high" Text="Hello from $(Ledger), built by MSBuild $(MSBuildVersion) on $(OS)." />
</Target>
</Project>
dotnet msbuild hello.proj -t:Hello -nologo -v:m
dotnet msbuild -version
Hello from Ledgerline, built by MSBuild 18.9.15 on Unix.
18.9.15.50611
The difference between dotnet msbuild and dotnet build shows on a fresh clone of the Ledgerline library, which has
never been restored:
cd src/Ledgerline
dotnet msbuild -tl:off -v:m # no restore: fails for each target framework
dotnet msbuild -restore -tl:off -v:m # what dotnet build does
<sdk>/Sdks/Microsoft.NET.Sdk/targets/Microsoft.PackageDependencyResolution.targets(266,5): error NETSDK1004: Assets file '~/ledgerline/src/Ledgerline/obj/project.assets.json' not found. Run a NuGet package restore to generate this file. [~/ledgerline/src/Ledgerline/Ledgerline.csproj::TargetFramework=net8.0]
…
Restored ~/ledgerline/src/Ledgerline/Ledgerline.csproj (in 281 ms).
Ledgerline -> ~/ledgerline/src/Ledgerline/bin/Debug/netstandard2.0/Ledgerline.dll
Ledgerline -> ~/ledgerline/src/Ledgerline/bin/Debug/net8.0/Ledgerline.dll
Ledgerline -> ~/ledgerline/src/Ledgerline/bin/Debug/net10.0/Ledgerline.dll
Versions
| MSBuild | Visual Studio | .NET SDK | Notes |
|---|---|---|---|
15.x |
2017 |
.NET Core 1.x—2.x |
SDK-style projects |
16.x |
2019 |
.NET Core 3.x, .NET 5 |
|
17.0 |
2022 17.0 |
.NET 6 |
64-bit |
17.8 |
2022 17.8 |
.NET 8 (8.0.1xx) |
Terminal Logger opt-in |
17.12 |
2022 17.12 |
.NET 9 (9.0.1xx) |
Terminal Logger default, BuildCheck |
18.0 |
2026 18.0 |
.NET 10 (10.0.1xx) |
.NET task host |
18.9 |
— |
10.0.4xx (10.0.402) |
this section’s baseline |
18.11 |
2026 18.11 |
— |
latest stable release (GitHub v18.11.0) |
18.12 (preview) |
— |
.NET 11 RC 2 (11.0.100-rc.2) |
preview |
dotnet msbuild -version (or msbuild -version) prints the version in use; $(MSBuildVersion) holds it inside a
project. The full history is on
Versions and Release History.
Release history at a glance
MSBuild has no "what’s new" page after 17.0; later changes are in the
GitHub releases (whose tags were listed with git ls-remote on
2026-10-23), in the .NET SDK what’s-new pages and in the version notes inside individual MSBuild pages, which are what
this table cites. Rows marked re-verify were not checked against a release note.
| Release | Change |
|---|---|
15.0 (Visual Studio 2017) |
SDK-style projects and the |
15.8 |
|
16.x (Visual Studio 2019) |
static graph builds ( |
17.0 (Visual Studio 2022) |
64-bit |
17.8 (.NET 8) |
Terminal Logger ( |
17.12 (.NET 9) |
Terminal Logger on by default for interactive |
17.13 |
|
18.0 (Visual Studio 2026, .NET 10) |
.NET task host: tasks built for .NET run in |
18.6 |
|
18.9 |
this section’s baseline (in SDK 10.0.4xx) |
.NET 11 (preview, MSBuild 18.12) |
MSBuild Server on by default for |
Reading order
The pages build on each other in this order.
The language
-
Project File Anatomy — the elements and the evaluation/execution model
-
Properties, Items and Metadata, Property Functions, Item Functions and Transforms and Conditions
Execution
Extending a build
Running and diagnosing
How MSBuild fits with the SDK and NuGet in a whole build is on How a .NET Build Works.