@@ -75,20 +75,20 @@ Item attributes are for controlling how items could be initialized, added and re
7575 - use ` KeepMetadata ` or ` RemoveMetadata ` to optionally include or exclude metadata from when ** creating items by transforming** from another ** within a ` <Target> ` **
7676 ``` xml
7777 <ItemGroup >
78- <Old Include =" *" > <!-- [!code highlight] -->
79- <Foo >foo</Foo > <!-- [!code highlight] -->
80- <Bar >bar</Bar > <!-- [!code highlight] -->
81- </Old > <!-- [!code highlight] -->
78+ <Old Include =" *" > <!-- [!code highlight] -->
79+ <Foo >foo</Foo > <!-- [!code highlight] -->
80+ <Bar >bar</Bar > <!-- [!code highlight] -->
81+ </Old > <!-- [!code highlight] -->
8282 </ItemGroup >
8383
8484 <Target >
8585 <ItemGroup >
86- <New Include =" @(Old)" RemoveMetadata =" Foo" /> <!-- transform from Old --> <!-- [!code highlight] -->
86+ <New Include =" @(Old)" RemoveMetadata =" Foo" /> <!-- transform from Old --> <!-- [!code highlight] -->
8787 </ItemGroup >
8888 <!-- Old.Foo was removed after transformation -->
89- <Message Text =" Old.Foo was removed after transformation" <!-- [!code highlight] -->
90- Condition="%(New.Foo) == ''" <!-- [!code highlight] -->
91- Importance="high"/> <!-- [!code highlight] -->
89+ <Message Text =" Old.Foo was removed after transformation" <!-- [!code highlight] -->
90+ Condition="%(New.Foo) == ''" <!-- [!code highlight] -->
91+ Importance="high"/> <!-- [!code highlight] -->
9292 </Target >
9393 ```
9494 - use `KeepDuplicates` when adding new item within a `<Target >` that you expect the new would be added when deplicates exist.
@@ -103,10 +103,10 @@ Item attributes are for controlling how items could be initialized, added and re
103103 <Target Name =" Hello" >
104104 <ItemGroup >
105105 <!-- bar would not be added since it already exists in FooList -->
106- <FooList Include =" bar" KeepDuplicates =" false" /> <!-- [!code highlight] -->
106+ <FooList Include =" bar" KeepDuplicates =" false" /> <!-- [!code highlight] -->
107107 </ItemGroup >
108108 <!-- foo;bar;foo;qux -->
109- <Message Text =" @(FooList)" Importance =" high" ></Message > <!-- [!code highlight] -->
109+ <Message Text =" @(FooList)" Importance =" high" ></Message > <!-- [!code highlight] -->
110110 </Target >
111111 ```
112112- `Exclude`: exclude items on declaration
@@ -134,9 +134,9 @@ Item attributes are for controlling how items could be initialized, added and re
134134 <Target Name =" Hello" >
135135 <!-- Proj items are to be matched by metadata FileName -->
136136 <ItemGroup >
137- <CSFile Remove =" @(Proj)" <!-- [!code highlight] -->
138- MatchOnMetadata="FileName" <!-- [!code highlight] -->
139- MatchOnMetadataOptions="CaseSensitive" /> <!-- [!code highlight] -->
137+ <CSFile Remove =" @(Proj)" <!-- [!code highlight] -->
138+ MatchOnMetadata="FileName" <!-- [!code highlight] -->
139+ MatchOnMetadataOptions="CaseSensitive" /> <!-- [!code highlight] -->
140140 </ItemGroup >
141141 <!-- Remained cs items: Programs.cs -->
142142 <Message Text =" Remained cs items: %(CSFile.Identity)" Importance =" high" ></Message >
@@ -150,7 +150,7 @@ Item attributes are for controlling how items could be initialized, added and re
150150 <FooMetaData >this is a foo metadata</FooMetaData >
151151 </FooList >
152152 <!-- update FooMetaData for foo and bar -->
153- <FooList Update =" foo;bar" FooMetaData =" this is a bar metadata now!" /> <!-- [!code highlight] -->
153+ <FooList Update =" foo;bar" FooMetaData =" this is a bar metadata now!" /> <!-- [!code highlight] -->
154154 </ItemGroup >
155155
156156 <Target Name =" Hello" >
@@ -177,7 +177,7 @@ There's some intrinsic functions to be used to **transform** a item list to anot
177177></ItemGroup >
178178>
179179><Target Name =" Hello" >
180- > <Message Text =" %(FooList.Identity) @(FooList->Count())" Importance =" high" /> <!-- [!code highlight] -->
180+ > <Message Text =" %(FooList.Identity) @(FooList->Count())" Importance =" high" /> <!-- [!code highlight] -->
181181> <!-- foo 2
182182> bar 1
183183> qux 1 -->
@@ -224,10 +224,10 @@ Expression syntax in msbuild has some flavor of Command Prompt and PowerShell.
224224
225225 <Target Name =" Hello" >
226226 <!-- Collected metadata: Program.cs; ConsoleApp.csproj -->
227- <Message Text =" Collected metadata: @(MyFile->'%(FileName)%(Extension)')" <!-- [!code highlight] -->
228- Importance="high" /> <!-- [!code highlight] -->
229- <Message Text =" Exists: @(MyFile->Count())" <!-- 5 --> <!-- [!code highlight] -->
230- Importance="high" /> <!-- [!code highlight] -->
227+ <Message Text =" Collected metadata: @(MyFile->'%(FileName)%(Extension)')" <!-- [!code highlight] -->
228+ Importance="high" /> <!-- [!code highlight] -->
229+ <Message Text =" Exists: @(MyFile->Count())" <!-- 5 --> <!-- [!code highlight] -->
230+ Importance="high" /> <!-- [!code highlight] -->
231231 </Target >
232232 ```
233233
@@ -248,14 +248,14 @@ For [special characters](https://learn.microsoft.com/en-us/visualstudio/msbuild/
248248So one could include dedicated part of the config for different build scenarios.
249249
250250``` xml
251- <ItemGroup Condition =" '$(DotNetBuildSourceOnly)' == 'true'" > <!-- [!code highlight] -->
251+ <ItemGroup Condition =" '$(DotNetBuildSourceOnly)' == 'true'" > <!-- [!code highlight] -->
252252 <PackageVersion Include =" Microsoft.Build" Version =" 17.3.4" />
253253 <PackageVersion Include =" Microsoft.Build.Framework" Version =" 17.3.4" />
254254 <PackageVersion Include =" Microsoft.Build.Tasks.Core" Version =" 17.3.4" />
255255 <PackageVersion Include =" Microsoft.Build.Utilities.Core" Version =" 17.3.4" />
256256</ItemGroup >
257257
258- <ItemGroup Condition =" '$(DotNetBuildSourceOnly)' != 'true' and '$(TargetFramework)' != 'net472'" > <!-- [!code highlight] -->
258+ <ItemGroup Condition =" '$(DotNetBuildSourceOnly)' != 'true' and '$(TargetFramework)' != 'net472'" > <!-- [!code highlight] -->
259259 <PackageVersion Include =" Microsoft.Build" Version =" 17.7.2" />
260260 <PackageVersion Include =" Microsoft.Build.Framework" Version =" 17.7.2" />
261261 <PackageVersion Include =" Microsoft.Build.Tasks.Core" Version =" 17.7.2" />
@@ -308,21 +308,19 @@ Such approach seems to only allow updating on all existing items since `Include`
308308
309309 <Target Name =" Hello" >
310310 <ItemGroup >
311- <FooList > <!-- no Include here --> <!-- [!code highlight] -->
311+ <FooList > <!-- no Include here --> <!-- [!code highlight] -->
312312 <!-- update all existing items from FooList -->
313- <FooMetaData >this is a bar metadata now!</FooMetaData > <!-- [!code highlight] -->
313+ <FooMetaData >this is a bar metadata now!</FooMetaData > <!-- [!code highlight] -->
314314 </FooList >
315315 </ItemGroup >
316316
317- <Message Text =" %(FooList.Identity): %(FooList.FooMetaData)" Importance =" high" /> <!-- [!code highlight] -->
317+ <Message Text =" %(FooList.Identity): %(FooList.FooMetaData)" Importance =" high" /> <!-- [!code highlight] -->
318318 <!-- foo: this is a bar metadata now!
319319 bar: this is a bar metadata now!
320320 baz: this is a bar metadata now! -->
321321 </Target >
322322```
323323
324- ### Generating Items from Tasks
325-
326324## Importing
327325
328326- ` *.props ` should be imported in early stage
0 commit comments