msbuild

Topics related to msbuild:

Getting started with msbuild

This section provides an overview of what msbuild is, and why a developer might want to use it.

It should also mention any large subjects within msbuild, and link out to the related topics. Since the Documentation for msbuild is new, you may need to create initial versions of those related topics.

Frequently-used Tasks

Order of Property and Item Evaluation

For more detail, see Property and Item Evaluation Order on the MSDN documentation page Comparing Properties and Items.

Order of Target Execution

From MSDN: Target Build Order

Determining the Target Build Order

MSBuild determines the target build order as follows:

  1. InitialTargets targets are run.
  2. Targets specified on the command line by the /target switch are run. If you specify no targets on the command line, then the DefaultTargets targets are run. If neither is present, then the first target encountered is run.
  3. The Condition attribute of the target is evaluated. If the Condition attribute is present and evaluates to false, the target isn't executed and has no further effect on the build.
  4. Before a target is executed, its DependsOnTargets targets are run.
  5. Before a target is executed, any target that lists it in a BeforeTargets attribute is run.
  6. Before a target is executed, its Inputs attribute and Outputs attribute are compared. If MSBuild determines that any output files are out of date with respect to the corresponding input file or files, then MSBuild executes the target. Otherwise, MSBuild skips the target.
  7. After a target is executed or skipped, any target that lists it in an AfterTargets attribute is run.

Common Item Types: ProjectReference

When the OutputItemType parameter is used, additional parameters (metadata) may be applicable. For example, when OutputItemType is set to Content, CopyToOutputDirectory can be used.

ParameterDetails
CopyToOutputDirectory (metadata)Optional string. Determines whether to copy the file to the output directory. Values: Never, Always, PreserveNewest.