Skip to content

Commit a01b613

Browse files
authored
Merge pull request #6182 from ghogen/msbuild-issues
MSBuild issues
2 parents 9e98000 + 1f28e3c commit a01b613

9 files changed

+28
-30
lines changed

docs/msbuild/msbuild-best-practices.md

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -24,7 +24,7 @@ We recommend the following best practices for writing MSBuild scripts:
2424
</MyProperty>
2525
```
2626

27-
- Avoid wildcards when you select items. Instead, specify files explicitly. This makes it easier to track down errors that may occur when you add or delete files.
27+
- In general, avoid the use of wildcards when you select items. Instead, specify files explicitly. This is because in most project types, MSBuild expands wildcards at various times, such as when adding or removing items, which can lead to unexpected behavior. An exception to this is in .NET Core SDK-style projects, which do process wildcards correctly.
2828

2929
## See also
3030

docs/msbuild/msbuild-project-file-schema-reference.md

Lines changed: 3 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -48,9 +48,9 @@ The schema link in an MSBuild project file is not required in Visual Studio 2017
4848
|[PropertyGroup element (MSBuild)](../msbuild/propertygroup-element-msbuild.md)|*Property*|Condition|
4949
|[Sdk element (MSBuild)](../msbuild/sdk-element-msbuild.md)|--|Name<br /><br /> Version|
5050
|[Target element (MSBuild)](../msbuild/target-element-msbuild.md)|OnError<br /><br /> *Task*|AfterTargets<br /><br /> BeforeTargets<br /><br /> Condition<br /><br /> DependsOnTargets<br /><br /> Inputs<br /><br /> KeepDuplicateOutputs<br /><br /> Name<br /><br /> Outputs<br /><br /> Returns|
51-
|[Task element (MSBuild)](../msbuild/task-element-msbuild.md)|Output|Condition<br /><br /> ContinueOnError<br /><br /> *Parameter*|
52-
|[TaskBody element (MSBuild)](../msbuild/taskbody-element-msbuild.md)|*Data*|Evaluate|
53-
|[UsingTask element (MSBuild)](../msbuild/usingtask-element-msbuild.md)|ParameterGroup<br /><br /> TaskBody|AssemblyFile<br /><br /> AssemblyName<br /><br /> Condition<br /><br /> TaskFactory<br /><br /> TaskName|
51+
|[Task element of Target (MSBuild)](../msbuild/task-element-msbuild.md)|Output|Condition<br /><br /> ContinueOnError<br /><br /> *Parameter*|
52+
|[Task element of UsingTask (MSBuild)](../msbuild/taskbody-element-msbuild.md)|*Data*|Evaluate|
53+
|[UsingTask element (MSBuild)](../msbuild/usingtask-element-msbuild.md)|ParameterGroup<br /><br /> Task|AssemblyFile<br /><br /> AssemblyName<br /><br /> Condition<br /><br /> TaskFactory<br /><br /> TaskName|
5454
|[When element (MSBuild)](../msbuild/when-element-msbuild.md)|Choose<br /><br /> ItemGroup<br /><br /> PropertyGroup|Condition|
5555

5656
## See also

docs/msbuild/parameter-element.md

Lines changed: 3 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -68,9 +68,9 @@ Contains information about a specific parameter for a task that is generated by
6868
<Parameter2 ParameterType="System.Int" Required="True" Output="False"/>
6969
...
7070
</ParameterGroup>
71-
<TaskBody Evaluate="true">
72-
... Task factory-specific data ...
73-
</TaskBody>
71+
<Task Evaluate="true">
72+
... Task factory-specific data ...
73+
</Task>
7474
</UsingTask>
7575
```
7676

docs/msbuild/parametergroup-element.md

Lines changed: 3 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -62,9 +62,9 @@ Contains an optional list of parameters that will be present on the task that is
6262
<Parameter2 ParameterType="System.Int" Required="True" Output="False"/>
6363
...
6464
</ParameterGroup>
65-
<TaskBody Evaluate="true">
66-
... Task factory-specific data ...
67-
</TaskBody>
65+
<Task Evaluate="true">
66+
... Task factory-specific data ...
67+
</Task>
6868
</UsingTask>
6969
```
7070

docs/msbuild/task-element-msbuild.md

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -1,5 +1,5 @@
11
---
2-
title: Task Element (MSBuild) | Microsoft Docs
2+
title: Task Element of Target (MSBuild) | Microsoft Docs
33
ms.date: 03/13/2017
44
ms.topic: reference
55
dev_langs:
@@ -17,7 +17,7 @@ manager: jillfra
1717
ms.workload:
1818
- multiple
1919
---
20-
# Task element (MSBuild)
20+
# Task element of Target (MSBuild)
2121

2222
Creates and executes an instance of an MSBuild task. The element name is determined by the name of the task being created.
2323

docs/msbuild/taskbody-element-msbuild.md

Lines changed: 11 additions & 11 deletions
Original file line numberDiff line numberDiff line change
@@ -1,5 +1,5 @@
11
---
2-
title: TaskBody Element (MSBuild) | Microsoft Docs
2+
title: Task Element of UsingTask (MSBuild) | Microsoft Docs
33
ms.date: 03/13/2017
44
ms.topic: reference
55
dev_langs:
@@ -8,27 +8,27 @@ dev_langs:
88
- C++
99
- jsharp
1010
helpviewer_keywords:
11-
- TaskBody element [MSBuild]
12-
- <TaskBody> element [MSBuild]
11+
- Task element [MSBuild]
12+
- <Task> element [MSBuild]
1313
ms.assetid: 49d8741b-f1ea-4470-94fd-a1ac27341a6a
1414
author: ghogen
1515
ms.author: ghogen
1616
manager: jillfra
1717
ms.workload:
1818
- multiple
1919
---
20-
# TaskBody element (MSBuild)
20+
# Task element of UsingTask (MSBuild)
2121

2222
Contains the data that is passed to a `UsingTask` `TaskFactory`. For more information, see [UsingTask element (MSBuild)](../msbuild/usingtask-element-msbuild.md).
2323

2424
\<Project>
2525
\<UsingTask>
26-
\<TaskBody>
26+
\<Task>
2727

2828
## Syntax
2929

3030
```xml
31-
<TaskBody Evaluate="true/false" />
31+
<Task Evaluate="true/false" />
3232
```
3333

3434
## Attributes and elements
@@ -45,7 +45,7 @@ Contains the data that is passed to a `UsingTask` `TaskFactory`. For more inform
4545

4646
|Element|Description|
4747
|-------------|-----------------|
48-
|Data|The text between the `TaskBody` tags is sent verbatim to the `TaskFactory`.|
48+
|Data|The text between the `Task` tags is sent verbatim to the `TaskFactory`.|
4949

5050
### Parent elements
5151

@@ -55,7 +55,7 @@ Contains the data that is passed to a `UsingTask` `TaskFactory`. For more inform
5555

5656
## Example
5757

58-
The following example shows how to use the `TaskBody` element with an `Evaluate` attribute.
58+
The following example shows how to use the `Task` element with an `Evaluate` attribute.
5959

6060
```xml
6161
<UsingTask TaskName="MyTask" AssemblyName="My.Assembly" TaskFactory="MyTaskFactory">
@@ -64,9 +64,9 @@ Contains the data that is passed to a `UsingTask` `TaskFactory`. For more inform
6464
<Parameter2 ParameterType="System.Int" Required="True" Output="False"/>
6565
...
6666
</ParameterGroup>
67-
<TaskBody Evaluate="true">
68-
... Task factory-specific data ...
69-
</TaskBody>
67+
<Task Evaluate="true">
68+
... Task factory-specific data ...
69+
</Task>
7070
</UsingTask>
7171
```
7272

docs/msbuild/toc.yml

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -235,9 +235,9 @@
235235
href: sdk-element-msbuild.md
236236
- name: Target element
237237
href: target-element-msbuild.md
238-
- name: Task element
238+
- name: Task element of Target
239239
href: task-element-msbuild.md
240-
- name: TaskBody element
240+
- name: Task element of UsingTask
241241
href: taskbody-element-msbuild.md
242242
- name: UsingTask element
243243
href: usingtask-element-msbuild.md

docs/msbuild/usingtask-element-msbuild.md

Lines changed: 3 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -48,7 +48,7 @@ Maps the task that is referenced in a [Task](../msbuild/task-element-msbuild.md)
4848
|---------------|-----------------|
4949
|`AssemblyName`|Either the `AssemblyName` attribute or the `AssemblyFile` attribute is required.<br /><br /> The name of the assembly to load. The `AssemblyName` attribute accepts strong-named assemblies, although strong-naming is not required. Using this attribute is equivalent to loading an assembly by using the <xref:System.Reflection.Assembly.Load%2A> method in .NET.<br /><br /> You cannot use this attribute if the `AssemblyFile` attribute is used.|
5050
|`AssemblyFile`|Either the `AssemblyName` or the `AssemblyFile` attribute is required.<br /><br /> The file path of the assembly. This attribute accepts full paths or relative paths. Relative paths are relative to the directory of the project file or targets file where the `UsingTask` element is declared. Using this attribute is equivalent to loading an assembly by using the <xref:System.Reflection.Assembly.LoadFrom%2A> method in .NET.<br /><br /> You cannot use this attribute if the `AssemblyName` attribute is used.|
51-
|`TaskFactory`|Optional attribute.<br /><br /> Specifies the class in the assembly that is responsible for generating instances of the specified `Task` name. The user may also specify a `TaskBody` as a child element that the task factory receives and uses to generate the task. The contents of the `TaskBody` are specific to the task factory.|
51+
|`TaskFactory`|Optional attribute.<br /><br /> Specifies the class in the assembly that is responsible for generating instances of the specified `Task` name. The user may also specify a `Task` as a child element that the task factory receives and uses to generate the task. The contents of the `Task` are specific to the task factory.|
5252
|`TaskName`|Required attribute.<br /><br /> The name of the task to reference from an assembly. If ambiguities are possible, this attribute should always specify full namespaces. If there are ambiguities, MSBuild chooses an arbitrary match, which could produce unexpected results.|
5353
|`Condition`|Optional attribute.<br /><br /> The condition to evaluate. For more information, see [Conditions](../msbuild/msbuild-conditions.md).|
5454

@@ -85,9 +85,9 @@ Maps the task that is referenced in a [Task](../msbuild/task-element-msbuild.md)
8585
<Parameter2 ParameterType="System.Int" Required="True" Output="False"/>
8686
...
8787
</ParameterGroup>
88-
<TaskBody>
88+
<Task>
8989
... Task factory-specific data ...
90-
</TaskBody>
90+
</Task>
9191
</UsingTask>
9292
```
9393

docs/msbuild/walkthrough-creating-an-msbuild-project-file-from-scratch.md

Lines changed: 0 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -148,8 +148,6 @@ Tasks in the Build target are executed sequentially. In this case, the Visual C#
148148
> ```xml
149149
> <Compile Include="*.cs" />
150150
> ```
151-
>
152-
> However, we do not recommend the use of wildcard characters because it makes debugging and selective targeting more difficult if source files are added or deleted.
153151

154152
## Extend the path to include MSBuild
155153

0 commit comments

Comments
 (0)