Skip to content

MSBuild 16.4 参数列表

MSBuild 用于打包、发布 .NET 工程。
这里使用的版本为 16.4.0+e901037fe
启动命令格式如下:

bash
MSBuild.exe [选项] [项目文件 | 目录]

在项目文件中生成指定的目标。
如果未指定项目文件,MSBuild 将搜索当前工作目录来查找文件扩展名以“proj”结尾的文件并使用该文件。
如果如果指定了目录,MSBuild 将搜索此目录来查找项目文件。

示例:

bash
MSBuild MyApp.sln -t:Rebuild -p:Configuration=Release
MSBuild MyApp.csproj -t:Clean -p:Configuration=Debug;TargetFrameworkVersion=v3.5

参数

使用 "-option" 和 "/option" 均可指定参数。

-target:<targets>

在此项目中生成这些目标。
使用分号或逗号分隔多个目标,或者分别指定每个目标。
(缩写: -t)

示例:

bash
-target:Resources;Compile

如果指定了任何目标,则它们会替换项目文件中 DefaultTargets 设置。

xml
<Project ToolsVersion="4.0" DefaultTargets="Clean;Build" xmlns="http://schemas.microsoft.com/developer/msbuild/2003">

默认构建目标可以在 MSBuild 的安装目录找到,我本机上的具体文件地址为

  • 2017:C:\Program Files (x86)\Microsoft Visual Studio\2017\Community\MSBuild\15.0\Bin\Microsoft.Common.CurrentVersion.targets
  • 2019:C:\Program Files (x86)\Microsoft Visual Studio\2019\Community\MSBuild\Current\Bin\Microsoft.Common.CurrentVersion.targets

具体的构建目标见文后的 附 1. 默认构建目标

-property:<n>=<v>

设置或重写这些项目级属性。
<n> 是属性名,<v> 为属性值。
请使用分号或逗号分隔多个属性,或者分别指定每个属性。
(缩写: -p)

示例:

bash
-property:WarningLevel=2;OutDir=bin\Debug\

这里的 <n> 对应的是项目工程文件 .csproj 中的 <Project><PropertyGroup> 下的子属性。

下面是从一个项目文件和一个发布配置中截取出来的部分配置,以供参考。

xml
<?xml version="1.0" encoding="utf-8"?>
<Project ToolsVersion="4.0" DefaultTargets="Build" xmlns="http://schemas.microsoft.com/developer/msbuild/2003">
  <Import Project="$(MSBuildExtensionsPath)\$(MSBuildToolsVersion)\Microsoft.Common.props" Condition="Exists('$(MSBuildExtensionsPath)\$(MSBuildToolsVersion)\Microsoft.Common.props')" />
  <PropertyGroup>
    <Configuration Condition=" '$(Configuration)' == '' ">Debug</Configuration>
    <Platform Condition=" '$(Platform)' == '' ">AnyCPU</Platform>
    <ProductVersion></ProductVersion>
    <SchemaVersion>2.0</SchemaVersion>
    <ProjectGuid>{6F89B5BB-8DE7-438B-8DC3-D2F45190B14C}</ProjectGuid>
    <ProjectTypeGuids>{349c5851-65df-11da-9384-00165b846f21};{fae04ec0-301f-11c3-bf4b-00c04f79efbc}</ProjectTypeGuids>
    <OutputType>Library</OutputType>
    <AppDesignerFolder>Properties</AppDesignerFolder>
    <RootNamespace>WebApp</RootNamespace>
    <AssemblyName>WebApp</AssemblyName>
    <TargetFrameworkVersion>v4.5</TargetFrameworkVersion>
    <UseIISExpress>false</UseIISExpress>
    <IISExpressSSLPort />
    <IISExpressAnonymousAuthentication />
    <IISExpressWindowsAuthentication />
    <IISExpressUseClassicPipelineMode />
    <TargetFrameworkProfile />
    <SolutionDir Condition="$(SolutionDir) == '' Or $(SolutionDir) == '*Undefined*'">..\</SolutionDir>
    <RestorePackages>true</RestorePackages>
    <SccProjectName></SccProjectName>
    <SccLocalPath></SccLocalPath>
    <SccAuxPath></SccAuxPath>
    <SccProvider></SccProvider>
    <UseGlobalApplicationHostFile />
    <Use64BitIISExpress />
  </PropertyGroup>
  <PropertyGroup Condition=" '$(Configuration)|$(Platform)' == 'Debug|AnyCPU' ">
    <DebugSymbols>true</DebugSymbols>
    <DebugType>full</DebugType>
    <Optimize>false</Optimize>
    <OutputPath>bin\</OutputPath>
    <DefineConstants>DEBUG;TRACE</DefineConstants>
    <ErrorReport>prompt</ErrorReport>
    <WarningLevel>4</WarningLevel>
    <Prefer32Bit>false</Prefer32Bit>
    <PlatformTarget>AnyCPU</PlatformTarget>
  </PropertyGroup>
</Project>

-maxCpuCount[:n]

指定用于生成的最大并发进程数。
如果未使用开关,则使用的默认值为 1。
如果使用开关时不带值,MSBuild 将最多使用计算机上的处理器数。
(缩写: -m[:n])

-toolsversion:<version>

要在生成过程中使用的 MSBuild 工具集 (任务、目标等) 的版本。
此版本将重写各个项目指定的版本。
(缩写: -tv)

示例:

bash
-toolsversion:3.5

对于 MSBuild 4.5,可以为 version 指定以下值:2.0、3.5、4.0。
如果指定 4.0,VisualStudioVersion 生成属性会指定要使用的子工具集。

现在 version 还可以为 12.0 和 15.0。
Visual Studio 2010Visual Studio 2012 使用的 ToolsVersion 为 4.0Visual Studio 2013 使用的 ToolsVersion 为 12.0Visual Studio 2015 使用 ToolsVersion 14.0Visual Studio 2017 使用 ToolsVersion 15.0
关于 ToolVersion 的更多信息可以参考 这里

Visual Studio 2019 创建的项目仍然使用的是 15.0,不过最新的 MSBuild 已经是 16.0 了。当前我机器上已经安装了 2019,Current 目录下的应该就是 16.0。
使用 msbuild -version 命令看到的具体版本号是 16.4.0+e901037fe
关于 MSBuild 16.0 的更多信息可以参考 这里

-verbosity:<level>

在事件日志中显示此级别的信息量。
可用的详细程度有: q[uiet]m[inimal]n[ormal]d[etailed]diag[nostic]。(缩写: -v)

示例:

bash
-verbosity:quiet

-consoleloggerparameters:<parameters>

控制台记录器的参数。
(缩写: -clp)

可用参数包括:

  • PerformanceSummary -- 显示在任务、目标和项目上花费的时间。
  • Summary -- 结束时显示错误和警告的摘要。
  • NoSummary -- 结束时不显示错误和警告的摘要。
  • ErrorsOnly -- 仅显示错误。
  • WarningsOnly -- 仅显示警告。
  • NoItemAndPropertyList -- 在开始生成每个项目时不显示项和属性的列表。
  • ShowCommandLine -- 显示 TaskCommandLineEvent 消息。
  • ShowTimestamp -- 将时间戳作为所有消息的前缀显示。
  • ShowEventId -- 显示已开始事件、已完成事件和消息的事件 ID。
  • ForceNoAlign -- 不将文本与控制台缓冲区的大小匹配。
  • DisableConsoleColor -- 将默认控制台颜色用于所有记录消息。
  • DisableMPLogging -- 在非多处理器模式下运行时,禁用输出的多处理器日志记录样式。
  • EnableMPLogging -- 即使在非多处理器模式下运行,也启用多处理器日志记录样式。默认情况下启用此日志记录样式。
  • ForceConsoleColor--使用 ANSI 控制台颜色,即使控制台不支持它
  • Verbosity -- 重写此记录器的 -verbosity 设置。

示例:

bash
-consoleloggerparameters:PerformanceSummary;NoSummary;Verbosity=minimal

-noConsoleLogger

禁用默认控制台记录器,并且不将事件记录到控制台。
(缩写: -noConLog)

-fileLogger[n]

将生成输出记录到文件中。
默认情况下,该文件在当前目录中,名称为 "msbuild[n].log"。
所有节点中的事件合并到单个日志中。
fileLogger 的文件和其他参数的位置可以通过添加 "-fileLoggerParameters[n]" 开关来指定。
"n" (如果存在) 可以为 1-9 的数字,允许最多附加 10 个文件记录器。
(缩写: -fl[n])

-fileloggerparameters[n]:<parameters>

为文件记录器提供任何额外的参数。
存在此开关意味着存在对应的 -filelogger[n] 开关。
“n”(如果存在) 可以为 1-9 的数字。
任何分布式文件记录器也可以使用 -fileloggerparameters,具体可参阅 -distributedFileLogger 的说明。
(缩写: -flp[n])

为控制台记录器列出的相同参数可用。某些其他可用参数有:

  • LogFile -- 生成日志将写入其中的日志文件的路径。
  • Append -- 确定是将生成日志附加到日志文件,还是覆盖日志文件。
    如果设置此开关,则会将生成日志附加到日志文件;
    如果不设置此开关,则会覆盖现有日志文件的内容。
    默认值为不附加到日志文件。
  • Encoding -- 指定文件的编码,
    例如,UTF-8UnicodeASCII

默认的详细程度为 Detailed

示例:

bash
-fileLoggerParameters:LogFile=MyLog.log;Append;Verbosity=diagnostic;Encoding=UTF-8
-flp:Summary;Verbosity=minimal;LogFile=msbuild.sum
-flp1:warningsonly;logfile=msbuild.wrn
-flp2:errorsonly;logfile=msbuild.err

-distributedLogger:<central logger>*<forwarding logger>

使用此记录器来记录 MSBuild 中的事件,向每个节点附加不同的记录器实例。
要指定多个记录器,请分别指定每个记录器。
(缩写形式 -dl)

<logger> 语法为: [<class>,]<assembly>[,<options>][;<parameters>]
<logger class> 语法为: [<partial or full namespace>.]<logger class name>
<logger assembly> 语法为: {<assembly name>[,<strong name>] | <assembly file>}
记录器选项指定 MSBuild 创建记录器的方式。
<logger parameters> 是可选的,并且按键入的形式原样传递给记录器。(缩写形式: -l)

示例:

bash
-dl:XMLLogger,MyLogger,Version=1.0.2,Culture=neutral
-dl:MyLogger,C:\My.dll*ForwardingLogger,C:\Logger.dll

-distributedFileLogger

将生成输出记录到多个日志文件,每个 MSBuild 节点一个日志文件。
这些文件的初始位置为当前目录。
默认情况下,这些文件名为 “MSBuild<nodeid>.log”。
可通过添加“-fileLoggerParameters”开关来指定这些文件的位置和 fileLogger 的其他参数。

如果日志文件名是通过 fileLoggerParameters 开关设置的,分布式记录器将使用 fileName 作为模板并将节点 ID 附加到此 fileName 以便为每个节点创建一个日志文件。

-logger:<logger>

使用此记录器来记录 MSBuild 中的事件。
要指定多个记录器,请分别指定每个记录器。

<logger> 语法为: [<class>,]<assembly>[,<options>][;<parameters>]
<logger class> 语法为: [<partial or full namespace>.]<logger class name>
<logger assembly> 语法为: {<assembly name>[,<strong name>] | <assembly file>}
记录器选项指定 MSBuild 创建记录器的方式。
<logger parameters> 是可选的,并按键入的形式原样传递给记录器。(缩写形式: -l)

示例:

bash
-logger:XMLLogger,MyLogger,Version=1.0.2,Culture=neutral
-logger:XMLLogger,C:\Loggers\MyLogger.dll;OutputAsHTML

-binaryLogger[:[LogFile=]output.binlog[;ProjectImports={None,Embed,ZipFile}]]

将所有生成事件序列化为压缩的二进制文件。
默认情况下该文件位于当前目录并且名为 "msbuild.binlog"。
二进制日志是生成过程的详细描述,以后可将其于重新构建文本日志并由其他分析工具所使用。
二进制日志通常比大多数详细的文本诊断级日志小 10 到 20 倍,但它可以包含更多信息。
(缩写: -bl)

默认情况下,二进制记录器收集项目文件的源文本,包括生成期间所有导入的项目和目标文件。可选的 ProjectImports 开关控制此行为:

  • ProjectImports=None - 不收集项目导入项。
  • ProjectImports=Embed - 在日志文件中嵌入项目导入项。
  • ProjectImports=ZipFile - 将项目文件保存到 output.projectimports.zip,其中输出的名称与二进制日志文件名称相同。

ProjectImports 的默认设置为 Embed
注意: 记录器不会收集非 MSBuild 源文件,
例如 .cs.cpp 等。

可将 .binlog 文件以参数 (而不是项目/解决方案) 的形式传递给 msbuild.exe 对其进行“播放”。
其他记录器将接收日志文件中的信息,就像原始的生成正在发生一样。
你可以通过以下网址阅读有关二进制文件及其用法的详细信息: https://github.com/Microsoft/msbuild/wiki/Binary-Log

示例:

bash
-bl
-bl:output.binlog
-bl:output.binlog;ProjectImports=None
-bl:output.binlog;ProjectImports=ZipFile
-bl:..\..\custom.binlog
-binaryLogger

-warnAsError[:code[;code2]]

视为错误的警告代码列表。
使用分号或逗号分隔多个警告代码。
将所有警告视为错误,使用没有值的开关。
(缩写: -err[:c;[c2]])

示例:

bash
-warnAsError:MSB4130

当警告被视为错误时,目标将当作警告继续执行,但是整个生成将失败。

-warnAsMessage[:code[;code2]]

视为低重要性消息的警告代码列表。
使用分号或逗号分隔多个警告代码。
(缩写: -noWarn[:c;[c2]])

示例:

bash
-warnAsMessage:MSB3026

-validate

依据默认架构验证项目。
(缩写: -val)

-validate:<schema>

依据指定的架构验证项目。
(缩写: -val)

示例:

bash
-validate:MyExtendedBuildSchema.xsd

-ignoreprojectextensions:<extensions>

确定要生成的项目文件时要忽略的扩展名的列表。
使用分号或逗号来分隔多个扩展名。
(缩写: -ignore)

示例:

bash
-ignoreprojectextensions:.sln

-nodeReuse:<parameters>

允许或禁止重复使用 MSBuild 节点。
参数包括:

  • True -- 生成完成后节点将保留,并且将由后面的生成重复使用 (默认)
  • False -- 生成完成后节点将不会保留
    (缩写: -nr)

示例:

bash
-nr:true

-preprocess[:file]

通过嵌入将在生成过程中导入的所有文件并标记其边界,创建一个聚合的项目文件。
这对于了解导入什么文件、从何处导入以及这些文件在生成中的构成非常有用。
默认情况下,输出将写入控制台窗口。
如果提供输出文件的路径,则将改用该路径。
(缩写: -pp)

示例:

bash
-pp:out.txt

-detailedSummary

在生成的结尾显示有关所生成的配置以及如何向节点安排这些配置的详细信息。
(缩写: -ds)

-restore[:True|False]

在生成其他目标前,运行名为 Restore 的目标,并确保这些模板的生成使用最新还原的生成逻辑。
项目树需要先将包还原才能生成包时,将会用到此操作。
指定 -restore 与指定 -restore:True 相同。
请使用此参数替代来自响应文件的值。
(缩写: -r)

-restoreProperty:<n>=<v>

在还原期间设置或重写这些项目级属性并且不使用 -property 参数指定的属性。
<n> 为属性名称,<v> 为属性值。
使用分号或逗号分隔多个属性,或者分别指定每个属性。
(缩写: -rp)

示例:

bash
-restoreProperty:IsRestore=true;MyProperty=value

-profileEvaluation:<file>

配置文件 MSBuild 求值并将结果写入指定的文件。
如果指定文件的扩展为 .md,将以 markdown 格式生成结果。否则,将生成制表符分隔文件。

-interactive[:True|False]

指示允许生成中的操作与用户互动。
请勿在不需要互动的自动化场景中使用此参数。
指定 -interactive 与指定 -interactive:true 相同。
使用此参数替代来自响应文件中的值。

-isolateProjects[:True|False]

使 MSBuild 独立生成每个项目。

这是 MSBuild 更具限制性的模式,因为它要求可在评估时静态地发现项目关系图,但可在生成大型项目集时改善计划并降低内存开销。
(缩写: -isolate)

此标记处于试验阶段,可能无法按预期工作。

-inputResultsCaches:<cacheFile>...

输入缓存文件的分号分隔列表,MSBuild 将从这些文件中读取生成结果。
设置此列表还将打开分隔的生成 (-isolate)。
(缩写: -irc)

-outputResultsCache:[cacheFile]

输出缓存文件,MSBuild 将在生成结束时写入其生成结果缓存的内容。
设置它也会打开隔离的生成 (-isolate)。
(缩写: -orc)

-graphBuild[:True|False]

使 MSBuild 构造并生成项目关系图。

构造关系图涉及到识别对窗体依赖项的项目引用。
生成项目关系图涉及到在引用项目引用前尝试生成这些引用,这与传统的 MSBuild 计划不同。
(缩写: -graph)

此标记处于试验阶段,可能无法按预期工作。

@<file>

从文本文件插入命令行设置。
若要指定多个响应文件,请分别指定每个响应文件。

自动从以下位置使用任何名为 "msbuild.rsp" 的响应文件:
(1) msbuild.exe 的目录
(2) 生成的第一个项目或解决方案的目录

-noAutoResponse

不自动包括任何 MSBuild.rsp 文件。(缩写: -noAutoRsp)

不显示启动版权标志和版权消息。

-version

仅显示版本信息。
(缩写: -ver)

-help

显示此用法消息。
(缩写: -?-h)

1. 默认构建目标

下面的内容摘自 MSDN - MSBuild targets - Default build targets

点击查看默认构建目标
xml
===================================================
Build
The main build entry point.
===================================================
<Target Name="Build"
    Condition=" '$(_InvalidConfigurationWarning)' != 'true' "
    DependsOnTargets="$(BuildDependsOn)"
    Returns="$(TargetPath)" />


===================================================
BeforeBuild
Redefine this target in your project in order to run tasks just before Build
===================================================
<Target Name="BeforeBuild"/>


===================================================
AfterBuild
Redefine this target in your project in order to run tasks just after Build
===================================================
<Target Name="AfterBuild"/>


===================================================
CoreBuild
The core build step calls each of the build targets.
===================================================
<Target Name="CoreBuild"
    DependsOnTargets="$(CoreBuildDependsOn)">


===================================================
Rebuild
Delete all intermediate and final build outputs, and then build the project from scratch.
===================================================
<Target Name="Rebuild"
    Condition=" '$(_InvalidConfigurationWarning)' != 'true' "
    DependsOnTargets="$(RebuildDependsOn)"
    Returns="$(TargetPath)"/>


===================================================
BeforeRebuild
Redefine this target in your project in order to run tasks just before Rebuild
===================================================
<Target Name="BeforeRebuild"/>


===================================================
AfterRebuild
Redefine this target in your project in order to run tasks just after Rebuild
===================================================
<Target Name="AfterRebuild"/>


===================================================
BuildGenerateSources
Redefine this target in your project in order to run tasks for BuildGenerateSources
Set BuildPassReferences to enable P2P builds
===================================================
<Target Name="BuildGenerateSources"
    DependsOnTargets="BuildGenerateSourcesTraverse;$(BuildGenerateSourcesAction)" />


===================================================
BuildCompile
Redefine this target in your project in order to run tasks for BuildCompile
===================================================
<Target Name="BuildCompile"
    DependsOnTargets="BuildCompileTraverse;$(BuildCompileAction)" />


===================================================
BuildLink
Redefine this target in your project in order to run tasks for BuildLink
===================================================
<Target Name="BuildLink"
    DependsOnTargets="BuildLinkTraverse;$(BuildLinkAction)" />


===================================================
CopyRunEnvironmentFiles
Copy environment files necessary to run the user's app to the final directory.
This is a public target that can be invoked by an IDE.
This may be used by an IDE to make the app.config file available for running
the target app.
===================================================
<Target
    Name="CopyRunEnvironmentFiles"
    DependsOnTargets="PrepareForBuild;SetWin32ManifestProperties;_CopyAppConfigFile;_CleanRecordFileWrites"/>


===================================================
Run
Run the final build output if it is a .EXE
===================================================
<Target
    Name="Run"
    DependsOnTargets="$(RunDependsOn)">


===================================================
BuildOnlySettings
This target is called only when doing a real build.  It is specifically not called during project load.
===================================================
<Target Name="BuildOnlySettings">


===================================================
PrepareForBuild
Prepare the prerequisites for building.
===================================================
<Target Name="PrepareForBuild"
    DependsOnTargets="$(PrepareForBuildDependsOn)">


===================================================
GetFrameworkPaths
Get the paths for the .NET Framework installation directory

These paths are not used directly by this .targets file but are available for pre and
post build steps.

This is a generally overriden target, for example it is overriden in the Microsoft.NETFramework.targets file
===================================================
<Target Name="GetFrameworkPaths"/>


===================================================
GetReferenceAssemblyPaths
Get the paths for the Reference Assemblies for the known versions of the
.NET Framework.

These paths are used by the build process in order to resolve the correct
assemblies from the various directories, and to support multi-targeting
===================================================
<Target Name="GetReferenceAssemblyPaths"
    DependsOnTargets="$(GetReferenceAssemblyPathsDependsOn)">


===================================================
AssignLinkMetadata
For items of a certain set of whitelisted types, make sure that
if they are defined in a file other than the project file, that
they have "Link" metadata set to an appropriate default.
===================================================
<Target Name="AssignLinkMetadata"
    Condition=" '$(SynthesizeLinkMetadata)' == 'true' ">


===================================================
PreBuildEvent
Run the pre-build event if there is one.
===================================================
<Target Name="PreBuildEvent"
    Condition="'$(PreBuildEvent)'!=''"
    DependsOnTargets="$(PreBuildEventDependsOn)">


===================================================
UnmanagedUnregistration
If the main assembly had previously been registered for COM interop, unregister it now.
We will re-register the new version after it has been built.
===================================================
<Target Name="UnmanagedUnregistration"
    Condition="(('$(_AssemblyTimestampBeforeCompile)' != '$(_AssemblyTimestampAfterCompile)' or '$(RegisterForComInterop)' != 'true' or '$(OutputType)' != 'library') or
                ('$(_AssemblyTimestampBeforeCompile)' == '')) and
               Exists('@(_UnmanagedRegistrationCache)')"
    DependsOnTargets="$(UnmanagedUnregistrationDependsOn)">


===================================================
GetTargetFrameworkVersion
This stand-alone target returns the target framework version (i.e. v3.5, v4.0, etc.)
that would be used if we built this project.
===================================================
<Target
    Name="GetTargetFrameworkVersion"
    Returns="$(TargetFrameworkVersion)" />


===================================================
ResolveReferences
===================================================
<Target Name="ResolveReferences"
    DependsOnTargets="$(ResolveReferencesDependsOn)"/>


===================================================
BeforeResolveReferences
Redefine this target in your project in order to run tasks just before ResolveReferences
===================================================
<Target Name="BeforeResolveReferences"/>


===================================================
AfterResolveReferences
Redefine this target in your project in order to run tasks just after ResolveReferences
===================================================
<Target Name="AfterResolveReferences"/>


===================================================
AssignProjectConfiguration
Assigns the appropriate configuration to each project in the list of project references passed in.
Adds to the project references passed in any project references implied by dependencies expressed in the solution file, if any.
===================================================
<Target Name="AssignProjectConfiguration"
    Condition="'$(CurrentSolutionConfigurationContents)' != '' or '@(ProjectReference)'!=''">


===================================================
ResolveProjectReferences
Build referenced projects
===================================================
<Target Name="ResolveProjectReferences"
    DependsOnTargets="AssignProjectConfiguration;_SplitProjectReferencesByFileExistence"
    Returns="@(_ResolvedNativeProjectReferencePaths);@(_ResolvedProjectReferencePaths)">


===================================================
GetTargetPath
This stand-alone target returns the name of the build product (i.e. EXE, DLL)
that would be produced if we built this project.
===================================================
<Target Name="GetTargetPath"
    DependsOnTargets="$(GetTargetPathDependsOn)"
    Returns="$(TargetPath)"/>


===================================================
GetTargetPathWithTargetPlatformMoniker
This stand-alone target returns the name and version of the target platform for this project.
===================================================
<Target Name="GetTargetPathWithTargetPlatformMoniker"
    DependsOnTargets="$(GetTargetPathWithTargetPlatformMonikerDependsOn)"
    Returns="@(TargetPathWithTargetPlatformMoniker)">


===================================================
GetNativeManifest
Compute the manifest item for this project.
===================================================
<Target
    Name="GetNativeManifest"
    Returns="@(ComputedApplicationManifest)">


===================================================
ResolveNativeReferences
Resolve native references
===================================================
<Target Name="ResolveNativeReferences"
    Condition="'@(NativeReference)'!=''"
    DependsOnTargets="ResolveProjectReferences">


===================================================
ResolveAssemblyReferences
Given the list of assemblies, find the closure of all assemblies that they depend on. These are
what we need to copy to the output directory.

[IN]
@(Reference) - List of assembly references as fusion names.
@(_ResolvedProjectReferencePaths) - List of project references produced by projects that this project depends on.

    The 'Private' attribute on the reference corresponds to the Copy Local flag in IDE.
    The 'Private' flag can have three possible values:
        - 'True' means the reference should be Copied Local
        - 'False' means the reference should not be Copied Local
        - [Missing] means this task will decide whether to treat this reference as CopyLocal or not.

[OUT]
@(ReferencePath) - Paths to resolved primary files.
@(ReferenceDependencyPaths) - Paths to resolved dependency files.
@(_ReferenceRelatedPaths) - Paths to .xmls and .pdbs.
@(ReferenceSatellitePaths) - Paths to satellites.
@(_ReferenceSerializationAssemblyPaths) - Paths to XML serialization assemblies created by sgen.
@(_ReferenceScatterPaths) - Paths to scatter files.
@(ReferenceCopyLocalPaths) - Paths to files that should be copied to the local directory.
===================================================
<Target Name="ResolveAssemblyReferences"
    Returns="@(ReferencePath)"
    DependsOnTargets="$(ResolveAssemblyReferencesDependsOn)">


===================================================
GenerateBindingRedirects
Inject the binding redirects into the app config file based on suggested redirects as output from ResolveAssemblyReferences.

[IN]
@(AppConfigWithTargetPath) - Path to the source app config file. This can be null if the project
                             doesn't contain an app config file.
$(TargetFileName) -          The file name of the build target.

[OUT]
@(OutputAppConfigFile) -     Path to the output app config file in the intermediate directory.
===================================================
<Target Name="GenerateBindingRedirects"
    Inputs="$(MSBuildAllProjects);@(AppConfigFile);$(ResolveAssemblyReferencesStateFile);$(IntermediateOutputPath);@(SuggestedBindingRedirects)"
    Outputs="$(_GenerateBindingRedirectsIntermediateAppConfig)"
    Condition="'$(AutoGenerateBindingRedirects)' == 'true' and '$(GenerateBindingRedirectsOutputType)' == 'true'">


===================================================
GenerateBindingRedirectsUpdateAppConfig
Updates the project to use the generated app.config content.  This needs to run regardless of
inputs/outputs so it is seperate from GenerateBindingRedirects.
===================================================
<Target Name="GenerateBindingRedirectsUpdateAppConfig"
    AfterTargets="GenerateBindingRedirects"
    Condition="'$(AutoGenerateBindingRedirects)' == 'true' and '$(GenerateBindingRedirectsOutputType)' == 'true' and Exists('$(_GenerateBindingRedirectsIntermediateAppConfig)')">


===================================================
GetInstalledSDKs
Gets the list of SDKs installed in the SDKDirectoryRoot and SDKRegistryRoot locations
These paths are used by the ResolveSDKReference task and the ResolveAssemblyReference task.
===================================================
<Target Name="GetInstalledSDKLocations"
      DependsOnTargets="$(GetInstalledSDKLocationsDependsOn)"
      Returns="@(InstalledSDKLocations)" />


===================================================
ResolveSDKReferences
Given a list of SDKReference items and a list of resolved winmd files which may contain metadata as to which sdk they came from
we need to find the sdk root folders on disk and populate a ResolvedSDKReference item which has the full path to the SDK ROOT
and the sdk identity as a piece of metadata.
===================================================
<Target Name="ResolveSDKReferences"
    Returns="@(ResolvedSDKReference)"
    DependsOnTargets="$(ResolveSDKReferencesDependsOn)">


===================================================
FindInvalidProjectReferences
Find project to project references with target platform version higher than the one used by the current project and
creates a list of invalid references to be unresolved. It issues a warning for each invalid reference.
===================================================
<Target Name="FindInvalidProjectReferences"
    Condition ="'$(FindInvalidProjectReferences)' == 'true'"
    DependsOnTargets="$(FindInvalidProjectReferencesDependsOn)">


===================================================
ExpandSDKReferences
After we have resolved the sdk refrence we need to make sure that we automatically include the references which are part of the SDK (both winmd and dll)
as part of the assemblies passed to the compiler.

Project systems or project which do not want to reference all dlls or winmd files should override this target to do nothing.
===================================================
<Target Name="ExpandSDKReferences"
    Returns="@(ReferencesFromSDK)"
    DependsOnTargets="$(ExpandSDKReferencesDependsOn)" />


===================================================
ExportWindowsMDFile
When a project is generating a a winmd file through c# or vb, ect the compiler will create a WinMDModule file. This file needs to be run
through the winmdexp tool in order to generate the resulting WinMD file.
===================================================
<Target Name="ExportWindowsMDFile"
    DependsOnTargets="Compile"
    Condition="'$(ExportWinMDFile)' == 'true'"
    Inputs="@(IntermediateAssembly);@(DocFileItem);@(_DebugSymbolsIntermediatePath);@(ReferencePath);$(MSBuildAllProjects)"
    Outputs="$(_IntermediateWindowsMetadataPath);$(WinMDExpOutputPdb);$(WinMDOutputDocumentationFile)" />


===================================================
DesignTimeResolveAssemblyReferences
Given the list of assemblies, resolve their reference paths.
This target is called by Visual Studio at run time in order to filter references
according to the targeted framework.
===================================================
<Target Name="DesignTimeResolveAssemblyReferences"
    Condition="'$(DesignTimeReference)'!=''"
    DependsOnTargets="$(DesignTimeResolveAssemblyReferencesDependsOn)">


===================================================
ResolveComReferences
Resolve COM references
===================================================
<Target Name="ResolveComReferences"
    Condition="'@(COMReference)'!='' or '@(COMFileReference)'!=''"
    Returns="@(ReferencePath)"
    DependsOnTargets="PrepareForBuild;ResolveKeySource;ResolveAssemblyReferences" />


===================================================
PrepareResources
Prepare resources for the Compile step.
===================================================
<Target Name="PrepareResources"
    DependsOnTargets="$(PrepareResourcesDependsOn)"/>


===================================================
PrepareResourceNames
Prepare the names of resource files.
===================================================
<Target Name="PrepareResourceNames"
    DependsOnTargets="$(PrepareResourceNamesDependsOn)"/>


===================================================
AssignTargetPaths
This target creates <TargetPath> tags for items. <TargetPath> is a relative folder plus filename
for the destination of this item.
===================================================
<Target Name="AssignTargetPaths"
    DependsOnTargets="$(AssignTargetPathsDependsOn)">


===================================================
GetItemTargetPaths
This target returns all items that have TargetPath metadata assigned by the AssignTargetPaths target.
===================================================
<Target Name="GetItemTargetPaths"
    DependsOnTargets="AssignTargetPaths"
    Returns="
    @(EmbeddedResource);
    @(ContentWithTargetPath);
    @(_NoneWithTargetPath);
    @(_DeploymentBaseManifestWithTargetPath);
    " />


===================================================
SplitResourcesByCulture
Split EmbeddedResource items into five lists based on whether
they are resx files, licx files or other resources and whether they should be localized. Also adds Type and Culture
metadata. Type indicates whether the resource is "Resx" or "Non-Resx".
===================================================
<Target Name="SplitResourcesByCulture"
    DependsOnTargets="AssignTargetPaths">


===================================================
CreateCustomManifestResourceNames
Allows custom manifest resource name generation tasks to plug
into the build process
===================================================
<Target Name="CreateCustomManifestResourceNames"
    DependsOnTargets="$(CreateCustomManifestResourceNamesDependsOn)"/>


===================================================
ResGen
Run GenerateResource on the given resx files.
===================================================
<Target Name="ResGen"
    DependsOnTargets="$(ResGenDependsOn)"/>


===================================================
BeforeResGen
Redefine this target in your project in order to run tasks just before Resgen.
===================================================
<Target Name="BeforeResGen"/>


===================================================
AfterResGen
Redefine this target in your project in order to run tasks just after Resgen.
===================================================
<Target Name="AfterResGen"/>


===================================================
ResolveKeySource
Resolve the strong name key used to sign the assembly as well as the certificate used to
sign the ClickOnce manifests.
===================================================
<Target Name="ResolveKeySource"
    Condition="$(SignManifests) == 'true' or $(SignAssembly) == 'true'">


===================================================
Compile
===================================================
<Target Name="Compile"
    DependsOnTargets="$(CompileDependsOn)"/>


===================================================
GenerateTargetFrameworkMonikerAttribute
Emit the target framework moniker attribute as  a code fragment into a temporary source file for the compiler.
===================================================
<Target Name="GenerateTargetFrameworkMonikerAttribute"
    BeforeTargets="BeforeCompile"
    DependsOnTargets="PrepareForBuild;GetReferenceAssemblyPaths"
    Inputs="$(MSBuildToolsPath)\Microsoft.Common.targets"
    Outputs="$(TargetFrameworkMonikerAssemblyAttributesPath)"
    Condition="'$(GenerateTargetFrameworkAttribute)' == 'true'">


===================================================
GenerateAdditionalSources
Emit any specified code fragments into a temporary source file for the compiler.
===================================================
<Target Name="GenerateAdditionalSources"
    BeforeTargets="BeforeCompile"
    DependsOnTargets="PrepareForBuild;GetReferenceAssemblyPaths"
    Inputs="$(MSBuildAllProjects)"
    Outputs="$(AssemblyAttributesPath)"
    Condition="'@(AssemblyAttributes)' != '' and '$(GenerateAdditionalSources)' == 'true'">


===================================================
BeforeCompile
Redefine this target in your project in order to run tasks just before Compile.
===================================================
<Target Name="BeforeCompile"/>


===================================================
AfterCompile
Redefine this target in your project in order to run tasks just after Compile.
===================================================
<Target Name="AfterCompile"/>


===================================================
GenerateSerializationAssemblies
Run GenerateSerializationAssemblies on the assembly produced by this build.
===================================================
<Target Name="GenerateSerializationAssemblies"
    Condition="'$(_SGenGenerateSerializationAssembliesConfig)' == 'On' or ('@(WebReferenceUrl)'!='' and '$(_SGenGenerateSerializationAssembliesConfig)' == 'Auto')"
    DependsOnTargets="AssignTargetPaths;Compile;ResolveKeySource"
    Inputs="$(MSBuildAllProjects);@(IntermediateAssembly)"
    Outputs="$(IntermediateOutputPath)$(_SGenDllName)">


===================================================
CreateSatelliteAssemblies
Create one satellite assembly for every unique culture in the resources.
===================================================
<Target Name="CreateSatelliteAssemblies"
    DependsOnTargets="$(CreateSatelliteAssembliesDependsOn)" />


===================================================
GenerateSatelliteAssemblies
Actually run al.exe to create the satellite assemblies.
===================================================
<Target Name="GenerateSatelliteAssemblies"
    Inputs="$(MSBuildAllProjects);@(_SatelliteAssemblyResourceInputs);$(IntermediateOutputPath)$(TargetName)$(TargetExt)"
    Outputs="$(IntermediateOutputPath)%(Culture)\$(TargetName).resources.dll"
    Condition="'@(_SatelliteAssemblyResourceInputs)' != ''">


===================================================
ComputeIntermediateSatelliteAssemblies
Compute the paths to the intermediate satellite assemblies,
with culture attributes so we can copy them to the right place.
===================================================
<Target Name="ComputeIntermediateSatelliteAssemblies"
    Condition="@(EmbeddedResource->'%(WithCulture)') != ''"
    DependsOnTargets="$(ComputeIntermediateSatelliteAssembliesDependsOn)">


===================================================
SetWin32ManifestProperties
Set Win32Manifest and EmbeddedManifest properties to be used later in the build.
===================================================
<Target Name="SetWin32ManifestProperties"
    Condition="'$(Win32Manifest)'==''"
    DependsOnTargets="ResolveComReferences;ResolveNativeReferences;_SetExternalWin32ManifestProperties;_SetEmbeddedWin32ManifestProperties" />


===================================================
GenerateManifests
Generates ClickOnce application and deployment manifests or a native manifest.
===================================================
<Target Name="GenerateManifests"
    Condition="'$(GenerateClickOnceManifests)'=='true' or '@(NativeReference)'!='' or '@(ResolvedIsolatedComModules)'!='' or '$(GenerateAppxManifest)' == 'true'"
    DependsOnTargets="$(GenerateManifestsDependsOn)"/>


===================================================
GenerateApplicationManifest
Generates a ClickOnce or native application manifest.
An application manifest specifies declarative application identity, dependency and security information.
===================================================
<Target Name="GenerateApplicationManifest"
    DependsOnTargets="
        _DeploymentComputeNativeManifestInfo;
        _DeploymentComputeClickOnceManifestInfo;
        ResolveComReferences;
        ResolveNativeReferences;
        _GenerateResolvedDeploymentManifestEntryPoint"
    Inputs="
        $(MSBuildAllProjects);
        @(AppConfigWithTargetPath);
        $(_DeploymentBaseManifest);
        @(ResolvedIsolatedComModules);
        @(_DeploymentManifestDependencies);
        @(_DeploymentResolvedManifestEntryPoint);
        @(_DeploymentManifestFiles)"
    Outputs="@(ApplicationManifest)">


===================================================
GenerateDeploymentManifest
Generates a ClickOnce deployment manifest.
An deployment manifest specifies declarative application identity and application update information.
===================================================
<Target Name="GenerateDeploymentManifest"
    DependsOnTargets="GenerateApplicationManifest"
    Inputs="
        $(MSBuildAllProjects);
        @(ApplicationManifest)
        "
    Outputs="@(DeployManifest)">


===================================================
PrepareForRun
Copy the build outputs to the final directory if they have changed.
===================================================
<Target Name="PrepareForRun"
    DependsOnTargets="$(PrepareForRunDependsOn)"/>


===================================================
CopyFilesToOutputDirectory
Copy all build outputs, satellites and other necessary files to the final directory.
===================================================
<Target Name="CopyFilesToOutputDirectory"
    DependsOnTargets="
        ComputeIntermediateSatelliteAssemblies;
        _CopyFilesMarkedCopyLocal;
        _CopySourceItemsToOutputDirectory;
        _CopyAppConfigFile;
        _CopyManifestFiles;
        _CheckForCompileOutputs;
        _SGenCheckForOutputs">


===================================================
GetCopyToOutputDirectoryItems
Get all project items that may need to be transferred to the output directory.
This includes baggage items from transitively referenced projects. It would appear
that this target computes full transitive closure of content items for all referenced
projects; however that is not the case. It only collects the content items from its
immediate children and not children of children. The reason this happens is that
the ProjectReferenceWithConfiguration list that is consumed by _SplitProjectReferencesByFileExistence
is only populated in the current project and is empty in the children. The empty list
causes _MSBuildProjectReferenceExistent to be empty and terminates the recursion.
===================================================
<Target Name="GetCopyToOutputDirectoryItems"
    Returns="@(AllItemsFullPathWithTargetPath)"
    KeepDuplicateOutputs=" '$(MSBuildDisableGetCopyToOutputDirectoryItemsOptimization)' == '' "
    DependsOnTargets="$(GetCopyToOutputDirectoryItemsDependsOn)">


===================================================
UnmanagedRegistration
Registers the main assembly for COM interop.
===================================================
<Target Name="UnmanagedRegistration"
    Condition="'$(RegisterForComInterop)'=='true' and '$(OutputType)'=='library'"
    DependsOnTargets="$(UnmanagedRegistrationDependsOn)" />>


===================================================
IncrementalClean
Remove files that were produced in a prior build but weren't produced in the current build.
The reason is that if, for example, the name of the .exe has changed we want to delete the
old copy.

Leave the Clean cache file containing only the files produced in the current build.
===================================================
<Target Name="IncrementalClean"
    DependsOnTargets="_CleanGetCurrentAndPriorFileWrites">


===================================================
Clean
Delete all intermediate and final build outputs.
===================================================
<Target Name="Clean"
    Condition=" '$(_InvalidConfigurationWarning)' != 'true' "
    DependsOnTargets="$(CleanDependsOn)" />


===================================================
BeforeClean
Redefine this target in your project in order to run tasks just before Clean.
===================================================
<Target Name="BeforeClean"/>


===================================================
AfterClean
Redefine this target in your project in order to run tasks just after Clean.
===================================================
<Target Name="AfterClean"/>


===================================================
CleanReferencedProjects
Call Clean target on all Referenced Projects.
===================================================
<Target Name="CleanReferencedProjects"
    DependsOnTargets="AssignProjectConfiguration; _SplitProjectReferencesByFileExistence">


===================================================
CleanPublishFolder
===================================================
<Target Name="CleanPublishFolder"/>


===================================================
PostBuildEvent
Run the post-build event. This step is driven by two parameters:

(1) The $(RunPostBuildEvent) property is set by the user through the IDE and can be one of four values.

    - OnBuildSuccess: In this case, every step of the build must succeed for the post-build step to run.
    - <Blank>: This is the same as OnBuildSuccess.
    - OnOutputUpdated: In this case, the post-build step will run only if the main output assembly was
    actually updated.
    - Always: The post-build step is always run.

(2) The $(_AssemblyTimestampBeforeCompile) and $(_AssemblyTimestampAfterCompile) values are
    set by the _TimeStampBeforeCompile and _TimeStampAfterCompile targets.  If the assembly was actually
    rebuilt during this build, then the two values will be different.
===================================================
<Target Name="PostBuildEvent"
    Condition="'$(PostBuildEvent)' != '' and ('$(RunPostBuildEvent)' != 'OnOutputUpdated' or '$(_AssemblyTimestampBeforeCompile)' != '$(_AssemblyTimestampAfterCompile)')"
    DependsOnTargets="$(PostBuildEventDependsOn)">


===================================================
Publish
This target is only called when doing ClickOnce publishing outside the IDE, which implicitly builds before publishing.
===================================================
<Target Name="Publish"
    DependsOnTargets="$(PublishDependsOn)"/>


===================================================
SetGenerateManifests
This target simply assures the GenerateClickOnceManifests property is set whenever the publish target is invoked.
===================================================
<Target Name="SetGenerateManifests"/>


===================================================
PublishOnly
The "PublishOnly" target is intended for ClickOnce publishing inside the IDE, where the build has already been done
by the BuildManager.
===================================================
<Target Name="PublishOnly"
    DependsOnTargets="$(PublishOnlyDependsOn)"/>


===================================================
BeforePublish
Redefine this target in your project in order to run tasks just before Publish.
===================================================
<Target Name="BeforePublish"/>


===================================================
AfterPublish
Redefine this target in your project in order to run tasks just after Publish.
===================================================
<Target Name="AfterPublish"/>


===================================================
PublishBuild
Defines the set of targets that publishing is directly dependent on.
===================================================
<Target Name="PublishBuild"
    DependsOnTargets="$(PublishBuildDependsOn)"/>


===================================================
AllProjectOutputGroups
The targets below drive output groups, which provide generic information about a
project's inputs (e.g., content files, compilation sources, etc.) and built outputs
(e.g., built EXE/DLL, PDB, XML documentation files, etc.)

Each target may produce two kinds of items:  outputs and dependencies.  Outputs are
items from the current project; dependencies are items that are brought into the
current project as a result of referencing other projects or components.

For both outputs and dependencies, the Include attribute
specifies the location of the output/dependency; it must be a full path.  Any number
of additional attributes may be placed on an output/dependency item.
===================================================
<Target Name="AllProjectOutputGroups"
    DependsOnTargets="
        BuiltProjectOutputGroup;
        DebugSymbolsProjectOutputGroup;
        DocumentationProjectOutputGroup;
        SatelliteDllsProjectOutputGroup;
        SourceFilesProjectOutputGroup;
        ContentFilesProjectOutputGroup;
        SGenFilesOutputGroup"/>


===================================================
BuiltProjectOutputGroup
This target performs population of the Build project output group.
===================================================
<Target Name="BuiltProjectOutputGroup"
    Returns="@(BuiltProjectOutputGroupOutput)"
    DependsOnTargets="$(BuiltProjectOutputGroupDependsOn)">


===================================================
DebugSymbolsProjectOutputGroup
This target performs population of the Debug Symbols project output group.
===================================================
<Target Name="DebugSymbolsProjectOutputGroup"
    Returns="@(DebugSymbolsProjectOutputGroupOutput)"
    DependsOnTargets="$(DebugSymbolsProjectOutputGroupDependsOn)"/>


===================================================
DocumentationProjectOutputGroup
This target performs population of the Documentation project output group.
===================================================
<Target Name="DocumentationProjectOutputGroup"
    Returns="@(DocumentationProjectOutputGroupOutput)"
    DependsOnTargets="$(DocumentationProjectOutputGroupDependsOn)"/>


===================================================
SatelliteDllsProjectOutputGroup
This target performs population of the Satellite Files project output group.
===================================================
<Target Name="SatelliteDllsProjectOutputGroup"
    Returns="@(SatelliteDllsProjectOutputGroupOutput)"
    DependsOnTargets="$(SatelliteDllsProjectOutputGroupDependsOn)">


===================================================
SourceFilesProjectOutputGroup
This target performs population of the Source Files project output group.
Source files are items in the project whose type is "Compile" and "EmbeddedResource".
===================================================
<Target Name="SourceFilesProjectOutputGroup"
    Returns="@(SourceFilesProjectOutputGroupOutput)"
    DependsOnTargets="$(SourceFilesProjectOutputGroupDependsOn)">


===================================================
ContentFilesProjectOutputGroup
This target performs population of the Content Files project output group.
Content files are items in the project whose type is "Content".
===================================================
<Target Name="ContentFilesProjectOutputGroup"
    Returns="@(ContentFilesProjectOutputGroupOutput)"
    DependsOnTargets="$(ContentFilesProjectOutputGroupDependsOn)">


===================================================
SGenFilesOutputGroup
This target performs population of the GenerateSerializationAssemblies Files project output group.
GenerateSerializationAssemblies files are those generated by the GenerateSerializationAssemblies target and task.
===================================================
<Target Name="SGenFilesOutputGroup"
    Returns="@(SGenFilesOutputGroupOutput)"
    DependsOnTargets="$(SGenFilesOutputGroupDependsOn)"/>


===================================================
GetResolvedSDKReferences
These targets are to gather information from the SDKs.
===================================================
<Target Name="GetResolvedSDKReferences"
    DependsOnTargets="ResolveSDKReferences"
    Returns="@(ResolvedSDKReference)"/>


===================================================
PriFilesOutputGroup
This target performs population of the pri files output group
===================================================
<Target Name="PriFilesOutputGroup"
    Condition="'@(_ReferenceRelatedPaths)' != ''"
    DependsOnTargets="BuildOnlySettings;PrepareForBuild;AssignTargetPaths;ResolveReferences"
    Returns="@(PriFilesOutputGroupOutput)">


===================================================
SDKRedistOutputGroup
This target gathers the Redist folders from the SDKs which have been resolved.
===================================================
<Target Name="SDKRedistOutputGroup"
    Returns="@(SDKRedistOutputGroupOutput)"
    DependsOnTargets="$(SDKRedistOutputGroupDependsOn)"/>