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
The `Message` task is one of the many tasks that ships with MSBuild. For a complete list of available tasks and usage information, see [Task reference](../msbuild/msbuild-task-reference.md).
139
135
140
-
The `Message` task takes the string value of the Text attribute as input and displays it on the output device (or writes it to one or more logs, if applicable). The HelloWorld target executes the Message task twice: first to display "Hello", and then to display "World."
136
+
The `Message` task takes the string value of the `Text` attribute as input and displays it on the output device (or writes it to one or more logs, if applicable). The `HelloWorld` target executes the Message task twice: first to display "Hello", and then to display "World."
141
137
142
138
## Build the target
143
139
144
140
If you try to build this project from Visual Studio, it doesn't build the target you defined. That's because Visual Studio chooses the default target, which is still the one in the imported `.targets` file.
145
141
146
-
Run MSBuild from the **Developer Command Prompt** for Visual Studio to build the HelloWorld target defined previously. Use the -target or -t command-line switch to select the target.
142
+
Run MSBuild from the **Developer Command Prompt** for Visual Studio to build the HelloWorld target defined previously. Use the `-target` or `-t` command-line switch to select the target.
147
143
148
144
> [!NOTE]
149
145
> We will refer to the **Developer Command Prompt** as the **Command Window** in the following sections.
@@ -194,18 +190,18 @@ Run MSBuild from the **Developer Command Prompt** for Visual Studio to build the
194
190
All properties are child elements of PropertyGroup elements. The name of the property is the name of the child element, and the value of the property is the text element of the child element. For example,
appears later in the project file, or in a file imported later in the project file, then TargetFrameworkVersion takes the new value "v3.5."
204
+
appears later in the project file, or in a file imported later in the project file, then `TargetFrameworkVersion` takes the new value "net6.0"
209
205
210
206
## Examine a property value
211
207
@@ -261,24 +257,24 @@ Use this syntax to examine some of the properties in the project file.
261
257
Many properties like `Configuration` are defined conditionally, that is, the `Condition` attribute appears in the property element. Conditional properties are defined or redefined only if the condition evaluates to "true." Undefined properties are given the default value of an empty string. For example,
means "If the Configuration property hasn't been defined yet, define it and give it the value 'Debug'."
268
264
269
-
Almost all MSBuild elements can have a Condition attribute. For more discussion about using the Condition attribute, see [Conditions](../msbuild/msbuild-conditions.md).
265
+
Almost all MSBuild elements can have a `Condition` attribute. For more discussion about using the `Condition` attribute, see [Conditions](../msbuild/msbuild-conditions.md).
270
266
271
267
### Reserved properties
272
268
273
-
MSBuild reserves some property names to store information about the project file and the MSBuild binaries. MSBuildToolsPath is an example of a reserved property. Reserved properties are referenced with the $ notation like any other property. For more information, see [How to: Reference the name or location of the project file](../msbuild/how-to-reference-the-name-or-location-of-the-project-file.md) and [MSBuild reserved and well-known properties](../msbuild/msbuild-reserved-and-well-known-properties.md).
269
+
MSBuild reserves some property names to store information about the project file and the MSBuild binaries. MSBuildToolsPath is an example of a reserved property. Reserved properties are referenced with the `$` notation like any other property. For more information, see [How to: Reference the name or location of the project file](../msbuild/how-to-reference-the-name-or-location-of-the-project-file.md) and [MSBuild reserved and well-known properties](../msbuild/msbuild-reserved-and-well-known-properties.md).
274
270
275
271
### Environment variables
276
272
277
-
You can reference environment variables in project files the same way as build properties. For example, to use the PATH environment variable in your project file, use $(Path). If the project contains a property definition that has the same name as an environment variable, the property in the project overrides the value of the environment variable. For more information, see [How to: Use environment variables in a build](../msbuild/how-to-use-environment-variables-in-a-build.md).
273
+
You can reference environment variables in project files the same way as build properties. For example, to use the `PATH` environment variable in your project file, use `$(Path`). If the project contains a property definition that has the same name as an environment variable, the property in the project overrides the value of the environment variable. For more information, see [How to: Use environment variables in a build](../msbuild/how-to-use-environment-variables-in-a-build.md).
278
274
279
275
## Set properties from the command line
280
276
281
-
Properties can be defined on the command line using the -property or -p command line switch. Property values received from the command line override property values set in the project file and environment variables.
277
+
Properties can be defined on the command line using the `-property` or `-p` command line switch. Property values received from the command line override property values set in the project file and environment variables.
282
278
283
279
**To set a property value from the command line:**
284
280
@@ -298,7 +294,7 @@ MSBuild creates the Configuration property and gives it the value "Release."
298
294
299
295
## Special characters
300
296
301
-
Certain characters have special meaning in MSBuild project files. Examples of these characters include semicolons (;) and asterisks (*). In order to use these special characters as literals in a project file, they must be specified by using the syntax %\<xx>, where \<xx> represents the ASCII hexadecimal value of the character.
297
+
Certain characters have special meaning in MSBuild project files. Examples of these characters include semicolons (`;`) and asterisks (`*`). In order to use these special characters as literals in a project file, they must be specified by using the syntax `%<xx>`, where `<xx>` represents the ASCII hexadecimal value of the character.
302
298
303
299
Change the Message task to show the value of the Configuration property with special characters to make it more readable.
304
300
@@ -396,7 +392,7 @@ To change the separator of an item type, use the following syntax, where ItemTyp
396
392
@(ItemType, Separator)
397
393
```
398
394
399
-
Change the Message task to use carriage returns and line feeds (%0A%0D) to display Compile items one per line.
395
+
Change the `Message` task to use carriage returns and line feeds (%0A%0D) to display Compile items one per line.
400
396
401
397
**To display item type values one per line**
402
398
@@ -550,7 +546,7 @@ Notice how the phrase "Compile.DependentUpon" appears several times. The use of
550
546
551
547
### Well-known metadata
552
548
553
-
Whenever an item is added to an item list, that item is assigned some well-known metadata. For example, %(Filename) returns the file name of any item. For a complete list of well-known metadata, see [Well-known item metadata](../msbuild/msbuild-well-known-item-metadata.md).
549
+
Whenever an item is added to an item list, that item is assigned some well-known metadata. For example, `%(Filename)` returns the file name of any item. For a complete list of well-known metadata, see [Well-known item metadata](../msbuild/msbuild-well-known-item-metadata.md).
554
550
555
551
**To examine well-known metadata:**
556
552
@@ -583,7 +579,7 @@ By comparing the preceding two examples, you can see that while not every item i
583
579
584
580
### Metadata transformations
585
581
586
-
Item lists can be transformed into new item lists. To transform an item list, use the following syntax, where \<ItemType> is the name of the item type and \<MetadataName> is the name of the metadata:
582
+
Item lists can be transformed into new item lists. To transform an item list, use the following syntax, where `<ItemType>` is the name of the item type and `<MetadataName>` is the name of the metadata:
0 commit comments