SDK MSBuild Properties Reference
|
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. |
The .NET SDK reads hundreds of MSBuild properties; this page lists the ones a project or Directory.Build.props
typically sets, grouped as in the official reference, each with its default and a link to its documentation. The
defaults in the tables were read with dotnet msbuild -getProperty:… from a fresh dotnet new console project
targeting net10.0 with .NET SDK 10.0.402 (Debug unless noted); "(empty)" means the property is not set and the SDK
behaves as described. Properties of the C# compiler are documented with the compiler options, not on the SDK page; they
are linked there.
dotnet msbuild -getProperty:LangVersion -getProperty:Deterministic -getProperty:NuGetAuditMode -getProperty:PublishRelease
{
"Properties": {
"LangVersion": "14.0",
"Deterministic": "true",
"NuGetAuditMode": "all",
"PublishRelease": "true"
}
}
Framework
| Property | Default | Purpose |
|---|---|---|
from the template ( |
The one target framework. |
|
(empty) |
Several, separated by |
|
(SDK default) |
The |
Build and compiler
| Property | Default | Purpose |
|---|---|---|
(empty) — |
Nullable reference type analysis. |
|
|
C# version; the default follows the target framework. |
|
(empty) — |
Generated |
|
|
Same inputs, same assembly bytes. |
|
(empty) |
Normalise paths for CI builds (Reproducible and Deterministic Builds). |
|
|
Produce the XML documentation file. |
|
(derived) |
Its path. |
|
(empty) |
Allow preview APIs and language features. |
|
(empty) |
Turn off |
|
(empty) |
Build Windows-only projects on Linux/macOS. |
|
|
Every warning becomes an error. |
|
|
|
Optimisation and PDB format. |
|
Generate assembly attributes from |
|
(from Source Link) |
Commit appended to the informational version. |
Default items
| Property | Default | Purpose |
|---|---|---|
|
Master switch for the globs below. |
|
|
|
|
|
|
|
|
Everything else as |
|
|
Excluded from all default globs. |
The evaluated DefaultItemExcludes of the console project was
;bin\Debug//**;obj/Debug//**;bin\/**;obj//**;bin\Debug/net10.0/publish//**;**/*.user;**/*.*proj;**/*.sln;**/*.slnx;**/*.vssscc;**/.DS_Store
(SDK-Style Project Files).
Code analysis and SDK
| Property | Default | Purpose |
|---|---|---|
|
Run the CA analyzers. |
|
|
Rule set version. |
|
(empty) = |
How many rules are on. |
|
|
Report IDE rules in builds. |
|
(empty) |
CA warnings as errors, separately. |
|
the SDK band ( |
Behave like an older SDK band for SDK diagnostics. |
Details: Format and Code Analysis.
References and restore
| Property | Default | Purpose |
|---|---|---|
(empty) |
Central Package Management (Central Package Management). |
|
(empty) |
Do not flow project references transitively. |
|
(empty) |
Do not reference the shared framework implicitly. |
|
(empty) |
Allow packages built for other frameworks. |
|
|
(empty) |
Write and use |
|
|
Vulnerability audit during restore (Auditing Packages for Vulnerabilities). |
The restore properties are documented on the NuGet side (NuGet restore properties).
Run, testing and generated files
| Property | Default | Purpose |
|---|---|---|
(empty) |
Arguments for |
|
(empty) |
Working directory for |
|
(empty) — |
Marks a test project (not packable by default). |
|
(framework-specific) |
Run with MTP instead of VSTest. |
|
(empty) |
MTP via |
|
(empty) |
Write source-generator output to disk. |
|
(empty) |
Where. |
|
(empty) |
Turn off the implicit namespace imports of Visual Basic projects. |
See dotnet test.
Publish, trimming and runtime configuration
| Property | Default | Purpose |
|---|---|---|
(empty) |
Target platform. |
|
(empty) |
Platforms to restore for. |
|
|
Include the runtime. |
|
|
Native launcher. |
|
|
|
|
|
|
|
|
|
|
|
Write |
|
(empty) = |
Runtime roll-forward policy of the app. |
|
(empty) |
Keep only these resource cultures. |
|
|
(empty) |
Publishing modes (Publish and Deployment Models; trim-related properties). |
(empty) |
No culture data (smaller, no ICU). |
|
(empty) = on |
Dynamic profile-guided optimisation. |
|
(empty) = off |
Server GC. |
|
(empty) = on |
Background GC. |
Packages and package validation
| Property | Default | Purpose |
|---|---|---|
|
|
|
|
|
Whether |
|
(derived or empty) |
Package metadata (descriptive properties; Package Metadata, README, Icon and License). |
(empty) |
Validate the package’s API across frameworks and versions. |
|
(empty) |
Compare against this published version. |
|
(empty) |
Write accepted differences to a suppression file. |
Items
| Item | Purpose |
|---|---|
A NuGet dependency (PackageReference). |
|
A shared framework such as |
|
A |
|
Generates |
|
Generates |
|
Keep an assembly entirely when trimming. |
Item metadata such as CopyToPublishDirectory and LinkBase are listed at
Item metadata. Windows desktop
projects (WPF, Windows Forms) have further properties at
MSBuild reference for Microsoft.NET.Sdk.WindowsDesktop.
Common mistakes
-
Believing
NullableandImplicitUsingsare SDK defaults — the templates set them; an empty project has neither. -
Setting
TargetFrameworkandTargetFrameworkstogether — the singular wins for the outer build, with confusing results. -
Changing
DefaultItemExcludeswithout the$(DefaultItemExcludes);prefix —binandobjget compiled. -
Looking for compiler options on the SDK page —
LangVersion,Nullable,Deterministiclive in the C# compiler options reference.