MSBuild allows you to specify build-targets such as Build
or Clean
with -target:<build-target>
(Example: MSBuild.exe -target:Clean
).
Of course, a developer can define their own target using a .targets
xml file.
However, some targets, such as Build
or Clean
, are pre-defined by Microsoft.
What is the list of all default pre-defined build-targets that are common for all .NET languages?
A target element can have both Inputs and Outputs attributes, indicating what items the target expects as input, and what items it produces as output. If all output items are up-to-date, MSBuild skips the target, which significantly improves the build speed. This is called an incremental build of the target.
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. After the target is executed or skipped, any other target that lists it in an AfterTargets attribute is run.
To build a specific target of a specific project in a solution. At the command line, type MSBuild.exe <SolutionName>. sln , where <SolutionName> corresponds to the file name of the solution that contains the target that you want to execute.
A build target is a string that identifies a build rule in your project. Build targets are used as arguments to Buck commands, such as buck build and buck run . Build targets are also used as arguments to build rules to enable one build rule to reference another.
The standard build-targets that are common for all .NET languages are defined at Microsoft.Common.CurrentVersion.targets.
Here is the full list of build targets:
The targets that are prefixed with Before
or After
are intended to be overridden in projects.
If you love us? You can donate to us via Paypal or buy me a coffee so we can maintain and grow! Thank you!
Donate Us With