Skip to content

Commit 363849f

Browse files
authored
Merge pull request #2483 from v-thepet/msbuild3
MSBuild PR #8
2 parents 569df49 + 68633ac commit 363849f

10 files changed

+186
-192
lines changed

docs/msbuild/item-element-msbuild.md

Lines changed: 11 additions & 11 deletions
Original file line numberDiff line numberDiff line change
@@ -19,7 +19,7 @@ manager: douge
1919
ms.workload:
2020
- "multiple"
2121
---
22-
# Item Element (MSBuild)
22+
# Item element (MSBuild)
2323
Contains a user-defined item and its metadata. Every item that is used in a [!INCLUDE[vstecmsbuild](../extensibility/internals/includes/vstecmsbuild_md.md)] project must be specified as a child of an `ItemGroup` element.
2424

2525
\<Project>
@@ -38,7 +38,7 @@ Contains a user-defined item and its metadata. Every item that is used in a [!IN
3838
</Item>
3939
```
4040

41-
## Specify metadata as Attributes
41+
## Specify metadata as attributes
4242
In MSBuild 15.1 or later, any metadata with a name that doesn't conflict with the current list of attributes can optionally be expressed as an attribute.
4343

4444
For example, to specify a list of NuGet packages, you would normally use something like the following syntax.
@@ -59,7 +59,7 @@ Now, however, you can pass the `Version` metadata as an attribute, such as in th
5959
</ItemGroup>
6060
```
6161

62-
## Attributes and Elements
62+
## Attributes and elements
6363
The following sections describe attributes, child elements, and parent elements.
6464

6565
### Attributes
@@ -75,13 +75,13 @@ Now, however, you can pass the `Version` metadata as an attribute, such as in th
7575
|`RemoveMetadata`|Optional attribute.<br /><br /> The metadata for the source items to not transfer to the target items. All metadata is transferred from a source item to a target item except metadata whose names are contained in the semicolon-delimited list of names. For more information, see [Items](../msbuild/msbuild-items.md).<br /><br /> This attribute is valid only if it's specified for an item in an `ItemGroup` that's in a `Target`.|
7676
|`Update`|Optional attribute. (Available only for .NET Core projects in Visual Studio 2017 or later.)<br /><br /> Enables you to modify metadata of a file that was included by using a glob.<br /><br /> This attribute is valid only if it's specified for an item in an `ItemGroup` that is not in a `Target`.|
7777

78-
### Child Elements
78+
### Child elements
7979

8080
|Element|Description|
8181
|-------------|-----------------|
8282
|[ItemMetadata](../msbuild/itemmetadata-element-msbuild.md)|A user-defined item metadata key, which contains the item metadata value. There may be zero or more `ItemMetadata` elements in an item.|
8383

84-
### Parent Elements
84+
### Parent elements
8585

8686
|Element|Description|
8787
|-------------|-----------------|
@@ -90,9 +90,9 @@ Now, however, you can pass the `Version` metadata as an attribute, such as in th
9090
## Remarks
9191
`Item` elements define inputs into the build system, and are grouped into item collections based on their user-defined collection names. These item collections can be used as parameters for [tasks](../msbuild/msbuild-tasks.md), which use the individual items in the collections to perform the steps of the build process. For more information, see [Items](../msbuild/msbuild-items.md).
9292

93-
Using the notation `@(`*myType*`)` enables a collection of items of type *myType* to be expanded into a semicolon-delimited list of strings, and passed to a parameter. If the parameter is of type `string`, then the value of the parameter is the list of elements, separated by semicolons. If the parameter is an array of strings (`string[]`), then each element is inserted into the array based on the location of the semicolons. If the task parameter is of type <xref:Microsoft.Build.Framework.ITaskItem>`[]`, then the value is the contents of the item collection together with any metadata attached. To delimit each item by using a character other than a semicolon, use the syntax `@(`*myType*`, '`*separator*`')`.
93+
Using the notation @(\<myType>) enables a collection of items of type \<myType> to be expanded into a semicolon-delimited list of strings, and passed to a parameter. If the parameter is of type `string`, then the value of the parameter is the list of elements, separated by semicolons. If the parameter is an array of strings (`string[]`), then each element is inserted into the array based on the location of the semicolons. If the task parameter is of type <xref:Microsoft.Build.Framework.ITaskItem>`[]`, then the value is the contents of the item collection together with any metadata attached. To delimit each item by using a character other than a semicolon, use the syntax @(<myType>, '<separator>').
9494

95-
The [!INCLUDE[vstecmsbuild](../extensibility/internals/includes/vstecmsbuild_md.md)] engine can evaluate wildcards such as `*` and `?` and recursive wildcards such as `/**/*.cs`. For more information, see [Items](../msbuild/msbuild-items.md).
95+
The [!INCLUDE[vstecmsbuild](../extensibility/internals/includes/vstecmsbuild_md.md)] engine can evaluate wildcards such as `*` and `?` and recursive wildcards such as */\*\*/\*.cs*. For more information, see [Items](../msbuild/msbuild-items.md).
9696

9797
## Examples
9898
The following code example shows how to declare two items of type `CSFile`. The second declared item contains metadata that has `MyMetadata` set to `HelloWorld`.
@@ -105,7 +105,7 @@ Now, however, you can pass the `Version` metadata as an attribute, such as in th
105105
</CSFile>
106106
</ItemGroup>
107107
```
108-
The following code example shows how to use the `Update` attribute to modify the metadata in a file called somefile.cs that was included via a glob. (Available only for .NET Core projects in Visual Studio 2017 or later.)
108+
The following code example shows how to use the `Update` attribute to modify the metadata in a file called *somefile.cs* that was included via a glob. (Available only for .NET Core projects in Visual Studio 2017 or later.)
109109

110110
```xml
111111
<ItemGroup>
@@ -116,7 +116,7 @@ The following code example shows how to use the `Update` attribute to modify the
116116
```
117117

118118

119-
## See Also
119+
## See also
120120
[Items](../msbuild/msbuild-items.md)
121-
[MSBuild Properties](../msbuild/msbuild-properties.md)
122-
[Project File Schema Reference](../msbuild/msbuild-project-file-schema-reference.md)
121+
[MSBuild properties](../msbuild/msbuild-properties.md)
122+
[Project file schema reference](../msbuild/msbuild-project-file-schema-reference.md)

docs/msbuild/item-functions.md

Lines changed: 4 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -13,10 +13,10 @@ manager: douge
1313
ms.workload:
1414
- "multiple"
1515
---
16-
# Item Functions
16+
# Item functions
1717
Starting with MSBuild 4.0, code in tasks and targets can call item functions to get information about the items in the project. These functions simplify getting Distinct() items and are faster than looping through the items.
1818

19-
## String Item Functions
19+
## String item functions
2020
You can use string methods and properties in the .NET Framework to operate on any item value. For <xref:System.String> methods, specify the method name. For <xref:System.String> properties, specify the property name after "get_".
2121

2222
For items that have multiple strings, the string method or property runs on each string.
@@ -44,7 +44,7 @@ Starting with MSBuild 4.0, code in tasks and targets can call item functions to
4444
-->
4545
```
4646

47-
## Intrinsic Item Functions
47+
## Intrinsic item functions
4848
The table below lists the intrinsic functions available for items.
4949

5050
|Function|Example|Description|
@@ -95,5 +95,5 @@ Starting with MSBuild 4.0, code in tasks and targets can call item functions to
9595
-->
9696
```
9797

98-
## See Also
98+
## See also
9999
[Items](../msbuild/msbuild-items.md)

docs/msbuild/item-metadata-in-target-batching.md

Lines changed: 7 additions & 7 deletions
Original file line numberDiff line numberDiff line change
@@ -15,12 +15,12 @@ manager: douge
1515
ms.workload:
1616
- "multiple"
1717
---
18-
# Item Metadata in Target Batching
19-
[!INCLUDE[vstecmsbuild](../extensibility/internals/includes/vstecmsbuild_md.md)] has the ability to perform dependency analysis on the inputs and outputs of a build target. If it is determined that the inputs or outputs of the target are up-to-date, the target will be skipped and the build will procede. `Target` elements use the `Inputs` and `Outputs` attributes to specify the items to inspect during dependency analysis.
18+
# Item metadata in target batching
19+
[!INCLUDE[vstecmsbuild](../extensibility/internals/includes/vstecmsbuild_md.md)] has the ability to perform dependency analysis on the inputs and outputs of a build target. If it is determined that the inputs or outputs of the target are up-to-date, the target will be skipped and the build will proceed. `Target` elements use the `Inputs` and `Outputs` attributes to specify the items to inspect during dependency analysis.
2020

2121
If a target contains a task that uses batched items as inputs or outputs, the `Target` element of the target should use batching in its `Inputs` or `Outputs` attributes to enable [!INCLUDE[vstecmsbuild](../extensibility/internals/includes/vstecmsbuild_md.md)] to skip batches of items that are already up-to-date.
2222

23-
## Batching Targets
23+
## Batch targets
2424
The following example contains an item list named `Res` that is divided into two batches based on the `Culture` item metadata. Each of these batches is passed into the `AL` task, which creates an output assembly for each batch. By using batching on the `Outputs` attribute of the `Target` element, [!INCLUDE[vstecmsbuild](../extensibility/internals/includes/vstecmsbuild_md.md)] can determine if each of the individual batches is up-to-date before running the target. Without using target batching, both batches of items would be run by the task every time the target was executed.
2525

2626
```xml
@@ -61,8 +61,8 @@ ms.workload:
6161
</Project>
6262
```
6363

64-
## See Also
65-
[How to: Build Incrementally](../msbuild/how-to-build-incrementally.md)
64+
## See also
65+
[How to: Build incrementally](../msbuild/how-to-build-incrementally.md)
6666
[Batching](../msbuild/msbuild-batching.md)
67-
[Target Element (MSBuild)](../msbuild/target-element-msbuild.md)
68-
[Item Metadata in Task Batching](../msbuild/item-metadata-in-task-batching.md)
67+
[Target element (MSBuild)](../msbuild/target-element-msbuild.md)
68+
[Item metadata in task batching](../msbuild/item-metadata-in-task-batching.md)

docs/msbuild/item-metadata-in-task-batching.md

Lines changed: 21 additions & 21 deletions
Original file line numberDiff line numberDiff line change
@@ -16,7 +16,7 @@ manager: douge
1616
ms.workload:
1717
- "multiple"
1818
---
19-
# Item Metadata in Task Batching
19+
# Item metadata in task batching
2020
[!INCLUDE[vstecmsbuild](../extensibility/internals/includes/vstecmsbuild_md.md)] has the ability to divide item lists into different categories, or batches, based on item metadata, and run a task one time with each batch. It can be confusing to understand exactly what items are being passed with which batch. This topic covers the following common scenarios that involve batching.
2121

2222
- Dividing an item list into batches
@@ -26,10 +26,10 @@ ms.workload:
2626
- Batching one item at a time
2727

2828
- Filtering item lists
29+
30+
For more information on batching with [!INCLUDE[vstecmsbuild](../extensibility/internals/includes/vstecmsbuild_md.md)], see [Batching](../msbuild/msbuild-batching.md).
2931

30-
For more information on batching with [!INCLUDE[vstecmsbuild](../extensibility/internals/includes/vstecmsbuild_md.md)], see [Batching](../msbuild/msbuild-batching.md).
31-
32-
## Dividing an Item list into Batches
32+
## Divide an item list into batches
3333
Batching allows you to divide an item list into different batches based on item metadata, and pass each of the batches into a task separately. This is useful for building satellite assemblies.
3434

3535
The following example shows how to divide an item list into batches based on item metadata. The `ExampColl` item list is divided into three batches based on the `Number` item metadata. The presence of `%(ExampColl.Number)`in the `Text` attribute notifies [!INCLUDE[vstecmsbuild](../extensibility/internals/includes/vstecmsbuild_md.md)] that batching should be performed. The `ExampColl` item list is divided into three batches based on the `Number` metadata, and each batch is passed separately into the task.
@@ -66,22 +66,22 @@ ms.workload:
6666

6767
</Project>
6868
```
69-
70-
The [Message Task](../msbuild/message-task.md) task displays the following information:
69+
70+
The [Message task](../msbuild/message-task.md) displays the following information:
7171

7272
`Number: 1 -- Items in ExampColl: Item1;Item4`
7373

7474
`Number: 2 -- Items in ExampColl: Item2;Item5`
7575

7676
`Number: 3 -- Items in ExampColl: Item3;Item6`
7777

78-
## Dividing Several Item lists into Batches
79-
[!INCLUDE[vstecmsbuild](../extensibility/internals/includes/vstecmsbuild_md.md)] can divide multiple item lists into batches based on the same metadata. This makes it easy to divide different item lists into batches to build multiple assemblies. For example, you could have an item list of .cs files divided into an application batch and an assembly batch, and an item list of resource files divided into an application batch and an assembly batch. You could then use batching to pass these item lists into one task and build both the application and the assembly.
78+
## Divide several item lists into batches
79+
[!INCLUDE[vstecmsbuild](../extensibility/internals/includes/vstecmsbuild_md.md)] can divide multiple item lists into batches based on the same metadata. This makes it easy to divide different item lists into batches to build multiple assemblies. For example, you could have an item list of *.cs* files divided into an application batch and an assembly batch, and an item list of resource files divided into an application batch and an assembly batch. You could then use batching to pass these item lists into one task and build both the application and the assembly.
8080

8181
> [!NOTE]
8282
> If an item list being passed into a task contains no items with the referenced metadata, every item in that item list is passed into every batch.
8383
84-
The following example shows how to divide multiple item list into batches based on item metadata. The `ExampColl` and `ExampColl2` item lists are each divided into three batches based on the `Number` item metadata. The presence of `%(Number)`in the `Text` attribute notifies [!INCLUDE[vstecmsbuild](../extensibility/internals/includes/vstecmsbuild_md.md)] that batching should be performed. The `ExampColl` and `ExampColl2` item lists are divided into three batches based on the `Number` metadata, and each batch is passed separately into the task.
84+
The following example shows how to divide multiple item list into batches based on item metadata. The `ExampColl` and `ExampColl2` item lists are each divided into three batches based on the `Number` item metadata. The presence of `%(Number)`in the `Text` attribute notifies [!INCLUDE[vstecmsbuild](../extensibility/internals/includes/vstecmsbuild_md.md)] that batching should be performed. The `ExampColl` and `ExampColl2` item lists are divided into three batches based on the `Number` metadata, and each batch is passed separately into the task.
8585

8686
```xml
8787
<Project
@@ -119,16 +119,16 @@ ms.workload:
119119
</Project>
120120
```
121121

122-
The [Message Task](../msbuild/message-task.md) task displays the following information:
122+
The [Message task](../msbuild/message-task.md) displays the following information:
123123

124124
`Number: 1 -- Items in ExampColl: Item1 ExampColl2: Item4`
125125

126126
`Number: 2 -- Items in ExampColl: Item2 ExampColl2: Item5`
127127

128128
`Number: 3 -- Items in ExampColl: Item3 ExampColl2: Item6`
129129

130-
## Batching One Item at a Time
131-
Batching can also be performed on well-known item metadata that is assigned to every item upon creation. This guarantees that every item in a collection will have some metadata to use for batching. The `Identity` metadata value is unique for every item, and is useful for dividing every item in an item list into a separate batch. For a complete list of well-known item metadata, see [Well-known Item Metadata](../msbuild/msbuild-well-known-item-metadata.md).
130+
## Batching one item at a time
131+
Batching can also be performed on well-known item metadata that is assigned to every item upon creation. This guarantees that every item in a collection will have some metadata to use for batching. The `Identity` metadata value is unique for every item, and is useful for dividing every item in an item list into a separate batch. For a complete list of well-known item metadata, see [Well-known item metadata](../msbuild/msbuild-well-known-item-metadata.md).
132132

133133
The following example shows how to batch each item in an item list one at a time. Because the `Identity` metadata value of every item is unique, the `ExampColl` item list is divided into six batches, each batch containing one item of the item list. The presence of `%(Identity)`in the `Text` attribute notifies [!INCLUDE[vstecmsbuild](../extensibility/internals/includes/vstecmsbuild_md.md)] that batching should be performed.
134134

@@ -155,7 +155,7 @@ ms.workload:
155155
</Project>
156156
```
157157

158-
The [Message Task](../msbuild/message-task.md) task displays the following information:
158+
The [Message task](../msbuild/message-task.md) displays the following information:
159159

160160
```
161161
Identity: "Item1" -- Items in ExampColl: Item1
@@ -166,7 +166,7 @@ Identity: "Item5" -- Items in ExampColl: Item5
166166
Identity: "Item6" -- Items in ExampColl: Item6
167167
```
168168

169-
## Filtering Item lists
169+
## Filtering item lists
170170
Batching can be used to filter out certain items from an item list before passing it to a task. For example, filtering on the `Extension` well-known item metadata value allows you to run a task on only files with a specific extension.
171171

172172
The following example shows how to divide an item list into batches based on item metadata, and then filter those batches when they are passed into a task. The `ExampColl` item list is divided into three batches based on the `Number` item metadata. The `Condition` attribute of the task specifies that only batches with a `Number` item metadata value of `2` will be passed into the task
@@ -207,16 +207,16 @@ Identity: "Item6" -- Items in ExampColl: Item6
207207
</Project>
208208
```
209209

210-
The [Message Task](../msbuild/message-task.md) task displays the following information:
210+
The [Message task](../msbuild/message-task.md) displays the following information:
211211

212212
```
213213
Items in ExampColl: Item2;Item5
214214
```
215215

216-
## See Also
217-
[Well-known Item Metadata](../msbuild/msbuild-well-known-item-metadata.md)
218-
[Item Element (MSBuild)](../msbuild/item-element-msbuild.md)
219-
[ItemMetadata Element (MSBuild)](../msbuild/itemmetadata-element-msbuild.md)
216+
## See also
217+
[Well-known item metadata](../msbuild/msbuild-well-known-item-metadata.md)
218+
[Item element (MSBuild)](../msbuild/item-element-msbuild.md)
219+
[ItemMetadata element (MSBuild)](../msbuild/itemmetadata-element-msbuild.md)
220220
[Batching](../msbuild/msbuild-batching.md)
221-
[MSBuild Concepts](../msbuild/msbuild-concepts.md)
222-
[MSBuild Reference](../msbuild/msbuild-reference.md)
221+
[MSBuild concepts](../msbuild/msbuild-concepts.md)
222+
[MSBuild reference](../msbuild/msbuild-reference.md)

0 commit comments

Comments
 (0)