Redigera

Dela via


MSBuild project file schema reference

Provides a table of all the MSBuild XML Schema elements with their available attributes and child elements.

MSBuild uses project files to instruct the build engine what to build and how to build it. MSBuild project files are XML files that adhere to the MSBuild XML schema. This section documents the XML schema definition (.xsd) file for MSBuild.

MSBuild XSD schema definition files

The schema link in an MSBuild project file is not required in Visual Studio 2017 and later. If present, it should be http://schemas.microsoft.com/developer/msbuild/2003 regardless of the version of Visual Studio. This value is not a live web destination; the most current MSBuild schema definition file (.xsd file) can be found at Microsoft.Build.xsd.

The following table shows links to each version of the XSD schema:

MSBuild Version GitHub link Raw link (for tooling)
17.7 Microsoft.Build.xsd version 17.7.0 raw
17.6 Microsoft.Build.xsd version 17.6.3 raw
17.5 Microsoft.Build.xsd version 17.5.1 raw
17.4 Microsoft.Build.xsd version 17.4.4 raw
17.3 Microsoft.Build.xsd version 17.3.1 raw
17.2 Microsoft.Build.xsd version 17.2.1 raw
17.1 Microsoft.Build.xsd version 17.1.1 raw
17.0 Microsoft.Build.xsd version 17.0.0 raw
16.11 Microsoft.Build.xsd version 16.11.2 raw
16.10 Microsoft.Build.xsd version 16.10.2 raw
16.9 Microsoft.Build.xsd version 16.9.2 raw
16.8 Microsoft.Build.xsd version 16.8.3 raw
16.7 Microsoft.Build.xsd version 16.7.0.37604 raw
16.4 Microsoft.Build.xsd version 16.4.0.56107 raw
15.9 Microsoft.Build.xsd version 15.9.21.664 raw

The top-level XSD file includes two other child XSD files, Microsoft.Build.CommonTypes.xsd and Microsoft.Build.Core.xsd. You can also find all the MSBuild XSD schema definition files in the Visual Studio installation folder under Xml\Schemas\1033\MSBuild.

For more about MSBuild versions, including a table of corresponding .NET SDK versions, see Overview of .NET, MSBuild, and Visual Studio versioning.

MSBuild XML schema elements

The following table lists all of the MSBuild XML schema elements along with their child elements and attributes.

Element Child elements Attributes
Choose element (MSBuild) Otherwise

When
--
Import element (MSBuild) -- Condition

Project
ImportGroup element Import Condition
Item element (MSBuild) ItemMetaData Condition

Exclude

Include

Remove
ItemDefinitionGroup element (MSBuild) Item Condition
ItemGroup element (MSBuild) Item Condition
ItemMetadata element (MSBuild) Item Condition
OnError element (MSBuild) -- Condition

ExecuteTargets
Otherwise element (MSBuild) Choose

ItemGroup

PropertyGroup
--
Output element (MSBuild) -- Condition

ItemName

PropertyName

TaskParameter
Parameter element -- Output

ParameterType

Required
ParameterGroup element Parameter --
Project element (MSBuild) Choose

Import

ItemGroup

ProjectExtensions

PropertyGroup

Target

UsingTask
DefaultTargets

InitialTargets

Sdk

ToolsVersion

TreatAsLocalProperty

xmlns
ProjectExtensions element (MSBuild) -- --
Property element (MSBuild) -- Condition
PropertyGroup element (MSBuild) Property Condition
Sdk element (MSBuild) -- Name

Version
Target element (MSBuild) OnError

Task
AfterTargets

BeforeTargets

Condition

DependsOnTargets

Inputs

KeepDuplicateOutputs

Name

Outputs

Returns
Task element of Target (MSBuild) Output Condition

ContinueOnError

Parameter
Task element of UsingTask (MSBuild) Data Evaluate
UsingTask element (MSBuild) ParameterGroup

Task
AssemblyFile

AssemblyName

Condition

TaskFactory

TaskName
When element (MSBuild) Choose

ItemGroup

PropertyGroup
Condition

See also