You signed in with another tab or window. Reload to refresh your session.You signed out in another tab or window. Reload to refresh your session.You switched accounts on another tab or window. Reload to refresh your session.Dismiss alert
Copy file name to clipboardExpand all lines: docs/msbuild/msbuild-task.md
+18-18Lines changed: 18 additions & 18 deletions
Original file line number
Diff line number
Diff line change
@@ -21,7 +21,7 @@ manager: douge
21
21
ms.workload:
22
22
- "multiple"
23
23
---
24
-
# MSBuild Task
24
+
# MSBuild task
25
25
Builds [!INCLUDE[vstecmsbuild](../extensibility/internals/includes/vstecmsbuild_md.md)] projects from another [!INCLUDE[vstecmsbuild](../extensibility/internals/includes/vstecmsbuild_md.md)] project.
|`Targets`|Optional `String` parameter.<br /><br /> Specifies the target or targets to build in the project files. Use a semicolon to separate a list of target names. If no targets are specified in the `MSBuild` task, the default targets specified in the project files are built. **Note:** The targets must occur in all the project files. If they do not, a build error occurs.|
43
43
|`ToolsVersion`|Optional `String` parameter.<br /><br /> Specifies the `ToolsVersion` to use when building projects passed to this task.<br /><br /> Enables an [!INCLUDE[vstecmsbuild](../extensibility/internals/includes/vstecmsbuild_md.md)] task to build a project that targets a different version of the [!INCLUDE[dnprdnshort](../code-quality/includes/dnprdnshort_md.md)] than the one specified in the project. Valid values are `2.0`, `3.0` and `3.5`. Default value is `3.5`.|
44
44
|`UnloadProjectsOnCompletion`|Optional `Boolean` parameter.<br /><br /> If `true`, the project will be unloaded once the operation is complete.|
45
-
|`UseResultsCache`|Optional `Boolean` parameter.<br /><br /> If `true`, the cached result will be returned, if present.If theMSBuild task is run, its result will be cached in a scope (ProjectFileName, GlobalProperties)[TargetNames]<br /><br /> as a list of build items|
45
+
|`UseResultsCache`|Optional `Boolean` parameter.<br /><br /> If `true`, the cached result will be returned, if present.<br /><br /> If the MSBuild task is run, its result will be cached in a scope <br /><br /> (ProjectFileName, GlobalProperties)[TargetNames]<br /><br /> as a list of build items|
46
46
47
47
## Remarks
48
-
In addition to the parameters listed above, this task inherits parameters from the <xref:Microsoft.Build.Tasks.TaskExtension> class, which itself inherits from the <xref:Microsoft.Build.Utilities.Task> class. For a list of these additional parameters and their descriptions, see [TaskExtension Base Class](../msbuild/taskextension-base-class.md).
48
+
In addition to the parameters listed above, this task inherits parameters from the <xref:Microsoft.Build.Tasks.TaskExtension> class, which itself inherits from the <xref:Microsoft.Build.Utilities.Task> class. For a list of these additional parameters and their descriptions, see [TaskExtension base class](../msbuild/taskextension-base-class.md).
49
49
50
-
Unlike using the [Exec Task](../msbuild/exec-task.md) to start MSBuild.exe, this task uses the same [!INCLUDE[vstecmsbuild](../extensibility/internals/includes/vstecmsbuild_md.md)] process to build the child projects. The list of already-built targets that can be skipped is shared between the parent and child builds. This task is also faster because no new [!INCLUDE[vstecmsbuild](../extensibility/internals/includes/vstecmsbuild_md.md)] process is created.
50
+
Unlike using the [Exec task](../msbuild/exec-task.md) to start *MSBuild.exe*, this task uses the same [!INCLUDE[vstecmsbuild](../extensibility/internals/includes/vstecmsbuild_md.md)] process to build the child projects. The list of already-built targets that can be skipped is shared between the parent and child builds. This task is also faster because no new [!INCLUDE[vstecmsbuild](../extensibility/internals/includes/vstecmsbuild_md.md)] process is created.
51
51
52
52
This task can process not only project files but also solution files.
53
53
54
54
Any configuration that is required by [!INCLUDE[vstecmsbuild](../extensibility/internals/includes/vstecmsbuild_md.md)] to enable projects to build at the same time, even if the configuration involves remote infrastructure (for example, ports, protocols, timeouts, retries, and so forth), must be made configurable by using a configuration file. When possible, configuration items should be able to be specified as task parameters on the `MSBuild` task.
55
55
56
56
Beginning in [!INCLUDE[vstecmsbuild](../extensibility/internals/includes/vstecmsbuild_md.md)] 3.5, Solution projects now surface TargetOutputs from all of the sub-projects it builds.
57
57
58
-
## Passing Properties to Projects
59
-
In versions of [!INCLUDE[vstecmsbuild](../extensibility/internals/includes/vstecmsbuild_md.md)] prior to [!INCLUDE[vstecmsbuild](../extensibility/internals/includes/vstecmsbuild_md.md)] 3.5, passing different sets of properties to different projects listed in the [!INCLUDE[vstecmsbuild](../extensibility/internals/includes/vstecmsbuild_md.md)] item was challenging. If you used the Properties attribute of the [MSBuild Task](../msbuild/msbuild-task.md), then its setting was applied to all of the projects being built unless you batched the [MSBuild Task](../msbuild/msbuild-task.md) and conditionally provided different properties for each project in the item list.
58
+
## Pass properties to projects
59
+
In versions of [!INCLUDE[vstecmsbuild](../extensibility/internals/includes/vstecmsbuild_md.md)] prior to [!INCLUDE[vstecmsbuild](../extensibility/internals/includes/vstecmsbuild_md.md)] 3.5, passing different sets of properties to different projects listed in the [!INCLUDE[vstecmsbuild](../extensibility/internals/includes/vstecmsbuild_md.md)] item was challenging. If you used the Properties attribute of the [MSBuild task](../msbuild/msbuild-task.md), then its setting was applied to all of the projects being built unless you batched the [MSBuild task](../msbuild/msbuild-task.md) and conditionally provided different properties for each project in the item list.
60
60
61
-
[!INCLUDE[vstecmsbuild](../extensibility/internals/includes/vstecmsbuild_md.md)] 3.5, however, provides two new reserved metadata items, Properties and AdditionalProperties, that provide you a flexible way to pass different properties for different projects being built using the [MSBuild Task](../msbuild/msbuild-task.md).
61
+
[!INCLUDE[vstecmsbuild](../extensibility/internals/includes/vstecmsbuild_md.md)] 3.5, however, provides two new reserved metadata items, Properties and AdditionalProperties, that provide you a flexible way to pass different properties for different projects being built using the [MSBuild task](../msbuild/msbuild-task.md).
62
62
63
63
> [!NOTE]
64
-
> These new metadata items are applicable only to items passed in the Projects attribute of the [MSBuild Task](../msbuild/msbuild-task.md).
64
+
> These new metadata items are applicable only to items passed in the Projects attribute of the [MSBuild task](../msbuild/msbuild-task.md).
65
65
66
-
## Multi-Processor Build Benefits
67
-
One of the major benefits of using this new metadata occurs when you build your projects in parallel on a multi-processor system. The metadata allows you to consolidate all projects into a single [MSBuild Task](../msbuild/msbuild-task.md) call without having to perform any batching or conditional [!INCLUDE[vstecmsbuild](../extensibility/internals/includes/vstecmsbuild_md.md)] tasks. And when you call only a single [MSBuild Task](../msbuild/msbuild-task.md), all of the projects listed in the Projects attribute will be built in parallel. (Only, however, if the `BuildInParallel=true` attribute is present in the [MSBuild Task](../msbuild/msbuild-task.md).) For more information, see [Building Multiple Projects in Parallel](../msbuild/building-multiple-projects-in-parallel-with-msbuild.md).
66
+
## Multi-processor build benefits
67
+
One of the major benefits of using this new metadata occurs when you build your projects in parallel on a multi-processor system. The metadata allows you to consolidate all projects into a single [MSBuild task](../msbuild/msbuild-task.md) call without having to perform any batching or conditional [!INCLUDE[vstecmsbuild](../extensibility/internals/includes/vstecmsbuild_md.md)] tasks. And when you call only a single [MSBuild task](../msbuild/msbuild-task.md), all of the projects listed in the Projects attribute will be built in parallel. (Only, however, if the `BuildInParallel=true` attribute is present in the [MSBuild task](../msbuild/msbuild-task.md).) For more information, see [Building multiple projects in parallel](../msbuild/building-multiple-projects-in-parallel-with-msbuild.md).
68
68
69
-
## Properties Metadata
70
-
A common scenario is when you are building multiple solution files using the [MSBuild Task](../msbuild/msbuild-task.md), only using different build configurations. You may want to build solution a1 using the Debug configuration and solution a2 using the Release configuration. In [!INCLUDE[vstecmsbuild](../extensibility/internals/includes/vstecmsbuild_md.md)] 2.0, this project file would look like the following:
69
+
## Properties metadata
70
+
A common scenario is when you are building multiple solution files using the [MSBuild task](../msbuild/msbuild-task.md), only using different build configurations. You may want to build solution a1 using the Debug configuration and solution a2 using the Release configuration. In [!INCLUDE[vstecmsbuild](../extensibility/internals/includes/vstecmsbuild_md.md)] 2.0, this project file would look like the following:
71
71
72
72
> [!NOTE]
73
73
> In the following example, "..." represents additional solution files.
By using the Properties metadata, however, you can simplify this to use a single [MSBuild Task](../msbuild/msbuild-task.md), as shown by the following:
86
+
By using the Properties metadata, however, you can simplify this to use a single [MSBuild task](../msbuild/msbuild-task.md), as shown by the following:
Consider the following scenario where you are building two solution files using the [MSBuild Task](../msbuild/msbuild-task.md), both using the Release configuration, but one using the x86 architecture and the other using the ia64 architecture. In [!INCLUDE[vstecmsbuild](../extensibility/internals/includes/vstecmsbuild_md.md)] 2.0, you would need to create multiple instances of the [MSBuild Task](../msbuild/msbuild-task.md): one to build the project using the Release configuration with the x86 Architecture, the other using the Release configuration with the ia64 architecture. Your project file would look like the following:
123
+
## AdditionalProperties metadata
124
+
Consider the following scenario where you are building two solution files using the [MSBuild task](../msbuild/msbuild-task.md), both using the Release configuration, but one using the x86 architecture and the other using the ia64 architecture. In [!INCLUDE[vstecmsbuild](../extensibility/internals/includes/vstecmsbuild_md.md)] 2.0, you would need to create multiple instances of the [MSBuild task](../msbuild/msbuild-task.md): one to build the project using the Release configuration with the x86 Architecture, the other using the Release configuration with the ia64 architecture. Your project file would look like the following:
Copy file name to clipboardExpand all lines: docs/msbuild/msbuild-tasks-specific-to-visual-cpp.md
+19-19Lines changed: 19 additions & 19 deletions
Original file line number
Diff line number
Diff line change
@@ -18,35 +18,35 @@ manager: douge
18
18
ms.workload:
19
19
- "cplusplus"
20
20
---
21
-
# MSBuild Tasks Specific to Visual C++
22
-
Tasks provide the code that runs during the build process. When Visual C++ is installed, the following tasks are available, in addition to those that are installed with [!INCLUDE[vstecmsbuild](../extensibility/internals/includes/vstecmsbuild_md.md)]. For more information, see [MSBuild (Visual C++) Overview](/cpp/build/msbuild-visual-cpp-overview).
21
+
# MSBuild tasks specific to Visual C++
22
+
Tasks provide the code that runs during the build process. When Visual C++ is installed, the following tasks are available, in addition to those that are installed with [!INCLUDE[vstecmsbuild](../extensibility/internals/includes/vstecmsbuild_md.md)]. For more information, see [MSBuild (Visual C++) overview](/cpp/build/msbuild-visual-cpp-overview).
23
23
24
24
In addition to the parameters for each task, every task also has the following parameters.
25
25
26
26
|Parameter|Description|
27
27
|---------------|-----------------|
28
28
|`Condition`|Optional `String` parameter.<br /><br /> A `Boolean` expression that the [!INCLUDE[vstecmsbuild](../extensibility/internals/includes/vstecmsbuild_md.md)] engine uses to determine whether this task will be executed. For information about the conditions that are supported by [!INCLUDE[vstecmsbuild](../extensibility/internals/includes/vstecmsbuild_md.md)], see [Conditions](../msbuild/msbuild-conditions.md).|
29
-
|`ContinueOnError`|Optional parameter. Can contain one of the following values:<br /><br /> - **WarnAndContinue** or **true**. When a task fails, subsequent tasks in the [Target](../msbuild/target-element-msbuild.md) element and the build continue to execute, and all errors from the task are treated as warnings<br />- **ErrorAndContinue**. When a task fails, subsequent tasks in the `Target` element and the build continue to execute, and all errors from the task are treated as errors.<br />- **ErrorAndStop** or **false** (default). When a task fails, the remaining tasks in the`Target` element and the build aren't executed, and the entire `Target` element and the build are considered to have failed.<br /><br /> Versions of the .NET Framework before 4.5 supported only the `true` and `false` values.<br /><br /> For more information, see [How to: Ignore Errors in Tasks](../msbuild/how-to-ignore-errors-in-tasks.md).|
29
+
|`ContinueOnError`|Optional parameter. Can contain one of the following values:<br /><br /> - **WarnAndContinue** or **true**. When a task fails, subsequent tasks in the [Target](../msbuild/target-element-msbuild.md) element and the build continue to execute, and all errors from the task are treated as warnings<br />- **ErrorAndContinue**. When a task fails, subsequent tasks in the `Target` element and the build continue to execute, and all errors from the task are treated as errors.<br />- **ErrorAndStop** or **false** (default). When a task fails, the remaining tasks in the`Target` element and the build aren't executed, and the entire `Target` element and the build are considered to have failed.<br /><br /> Versions of the .NET Framework before 4.5 supported only the `true` and `false` values.<br /><br /> For more information, see [How to: Ignore errors in tasks](../msbuild/how-to-ignore-errors-in-tasks.md).|
30
30
31
-
## Related Topics
31
+
###Related topics
32
32
33
33
|Title|Description|
34
34
|-----------|-----------------|
35
-
|[BscMake Task](../msbuild/bscmake-task.md)|Wraps the Microsoft Browse Information Maintenance Utility tool (bscmake.exe).|
36
-
|[CL Task](../msbuild/cl-task.md)|Wraps the Visual C++ compiler tool (cl.exe).|
37
-
|[CPPClean Task](../msbuild/cppclean-task.md)|Deletes the temporary files that MSBuild creates when a Visual C++ project is built.|
38
-
|[LIB Task](../msbuild/lib-task.md)|Wraps the Microsoft 32-Bit Library Manager tool (lib.exe).|
39
-
|[Link Task](../msbuild/link-task.md)|Wraps the Visual C++ linker tool (link.exe).|
40
-
|[MIDL Task](../msbuild/midl-task.md)|Wraps the Microsoft Interface Definition Language (MIDL) compiler tool (midl.exe).|
41
-
|[MT Task](../msbuild/mt-task.md)|Wraps the Microsoft Manifest Tool (mt.exe).|
42
-
|[RC Task](../msbuild/rc-task.md)|Wraps the Microsoft Windows Resource Compiler tool (rc.exe).|
43
-
|[SetEnv Task](../msbuild/setenv-task.md)|Sets or deletes the value of a specified environment variable.|
44
-
|[VCMessage Task](../msbuild/vcmessage-task.md)|Logs warning messages and error messages during a build. (Not extendable. Internal use only.)|
45
-
|[XDCMake Task](../msbuild/xdcmake-task.md)|Wraps the XML Documentation tool (xdcmake.exe), which merges XML document comment (.xdc) files into an .xml file.|
46
-
|[XSD Task](../msbuild/xsd-task.md)|Wraps the XML Schema Definition tool (xsd.exe), which generates schema or class files from a source. *See note below.*|
47
-
|[MSBuild Reference](../msbuild/msbuild-reference.md)|Describes the elements of the MSBuild system.|
35
+
|[BscMake task](../msbuild/bscmake-task.md)|Wraps the Microsoft Browse Information Maintenance Utility tool (*bscmake.exe*).|
36
+
|[CL task](../msbuild/cl-task.md)|Wraps the Visual C++ compiler tool (*cl.exe*).|
37
+
|[CPPClean task](../msbuild/cppclean-task.md)|Deletes the temporary files that MSBuild creates when a Visual C++ project is built.|
38
+
|[LIB task](../msbuild/lib-task.md)|Wraps the Microsoft 32-Bit Library Manager tool (*lib.exe*).|
39
+
|[Link task](../msbuild/link-task.md)|Wraps the Visual C++ linker tool (*link.exe*).|
40
+
|[MIDL task](../msbuild/midl-task.md)|Wraps the Microsoft Interface Definition Language (MIDL) compiler tool (*midl.exe*).|
41
+
|[MT task](../msbuild/mt-task.md)|Wraps the Microsoft Manifest Tool (*mt.exe*).|
42
+
|[RC task](../msbuild/rc-task.md)|Wraps the Microsoft Windows Resource Compiler tool (*rc.exe*).|
43
+
|[SetEnv task](../msbuild/setenv-task.md)|Sets or deletes the value of a specified environment variable.|
44
+
|[VCMessage task](../msbuild/vcmessage-task.md)|Logs warning messages and error messages during a build. (Not extendable. Internal use only.)|
45
+
|[XDCMake task](../msbuild/xdcmake-task.md)|Wraps the XML Documentation tool (*xdcmake.exe*), which merges XML document comment (*.xdc*) files into an *.xml* file.|
46
+
|[XSD task](../msbuild/xsd-task.md)|Wraps the XML Schema Definition tool (*xsd.exe*), which generates schema or class files from a source. *See note below.*|
47
+
|[MSBuild reference](../msbuild/msbuild-reference.md)|Describes the elements of the MSBuild system.|
48
48
|[Tasks](../msbuild/msbuild-tasks.md)|Describes tasks, which are units of code that can be combined to produce a build.|
49
-
|[Task Writing](../msbuild/task-writing.md)|Describes how to create a task.|
49
+
|[Task writing](../msbuild/task-writing.md)|Describes how to create a task.|
50
50
51
51
> [!NOTE]
52
-
> In Visual Studio 2017, C++ project support for xsd.exe is deprecated. You can still use the **Microsoft.VisualC.CppCodeProvider** APIs by manually adding **CppCodeProvider.dll** to the GAC.
52
+
> In Visual Studio 2017, C++ project support for *xsd.exe* is deprecated. You can still use the **Microsoft.VisualC.CppCodeProvider** APIs by manually adding *CppCodeProvider.dll* to the GAC.
0 commit comments