以下部分引用自https://www.cnblogs.com/shanyou/p/3452938.html
MSBuild是Visual Studio的生成系统,可以简单的理解为Visual Studio的编译器,它能解释构造文件,执行构造动作,生成工程文件
MSBuild所解释的项目文件已XML架构定义,依靠XML文件来指示生成引擎生成哪些内容以及如何生成这些内容。
简单列一下MSBuild XML架构元素https://msdn.microsoft.com/zh-cn/library/5dy88c2e(v=vs.120).aspx元素
Element | child Elements | Attributes |
Choose Element(MSBuild) | Otherwise When |
-- |
Import Element(MSBuild) | -- | Condition Project |
ImportGroup Element(MSBuild) | 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 | -- | Condition ExecuteTargets |
OtherWise Element(MSBuild) | Choose ItemGroup PropertyGroup |
-- |
Output Element(MSBuild) | -- | Condition ItemName PropertyName TaskParameter |
Parameter Element(MSBuild) | -- | Output ParameterType Required |
ParameterGroup Element(MSBuild) |
Parameter | -- |
Project Element(MSBuild) | Choose Import ItemGroup PorjectExtensions PropertyGroup Target UsingTask |
DefaultTargets InitialTargets ToolsVersion TreatAsLocalProperty xmlns |
ProjectExtensions Element(MSBuild) | -- | -- |
Property Element(MSBuild) | -- | Condition |
PropertyGroup Element(MSBuild) | Property | Condition |
Target Element(MSBuild) | OnError Task |
AfterTargets BeforeTargets Condition DependsOnTargets Inputs KeepDuplicateOutputs Name Outputs Returns |
Task Element(MSBuild) | Output | Condition ContinueOnError Parameter |
TaskBody Element(MSBuild) | Data | Evaluate |
UsingTask Element(MSBuild) | ParameterGroup TaksBody |
AssemblyFile AssemblyName Condition TaskFactory TaskName |
When Element(MSBuild) | Choose ItemGroup PropertyGroup |
Condition |
- Project元素
这是每一个项目文件的最外层元素,它表示了一个项目的范围,不可或缺。
注意它的子元素Targets和属性DefaultTargets,有些人把它的DefaultTargets看成目标