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/how-to-build-specific-targets-in-solutions-by-using-msbuild-exe.md
+12-12Lines changed: 12 additions & 12 deletions
Original file line number
Diff line number
Diff line change
@@ -15,30 +15,30 @@ manager: douge
15
15
ms.workload:
16
16
- "multiple"
17
17
---
18
-
# How to: Build Specific Targets in Solutions By Using MSBuild.exe
19
-
You can use MSBuild.exe to build specific targets of specific projects in a solution.
18
+
# How to: Build specific targets in solutions by using MSBuild.exe
19
+
You can use *MSBuild.exe* to build specific targets of specific projects in a solution.
20
20
21
-
### To build a specific target of a specific project in a solution
21
+
####To build a specific target of a specific project in a solution
22
22
23
23
1. At the command line, type `MSBuild.exe <SolutionName>.sln`, where `<SolutionName>` corresponds to the file name of the solution that contains the target that you want to execute.
24
24
25
-
2. Specify the target after the `/target:` switch in the format **`ProjectName`**`:`**`TargetName`**. If the project name contains any of the characters `%`, `$`, `@`, `;`, `.`, `(`, `)`, or `'`, replace them with an `_` in the specified target name.
25
+
2. Specify the target after the `/target:` switch in the format \<ProjectName>:\<TargetName>. If the project name contains any of the characters `%`, `$`, `@`, `;`, `.`, `(`, `)`, or `'`, replace them with an `_` in the specified target name.
26
26
27
27
## Example
28
-
The following example executes the `Rebuild` target of the `NotInSlnFolder` project, and then executes the `Clean` target of the `InSolutionFolder` project, which is located in the `NewFolder` solution folder.
28
+
The following example executes the `Rebuild` target of the `NotInSlnFolder` project, and then executes the `Clean` target of the `InSolutionFolder` project, which is located in the *NewFolder* solution folder.
If you would like to examine the options available to you, you can use a debugging option provided by MSBuild to do so. Set the environment variable `MSBUILDEMITSOLUTION=1` and build your solution. This will produce an MSBuild file named `<SolutionName>.sln.metaproj` that shows MSBuild's internal view of the solution at build time. You can inspect this view to determine what targets are available to build.
36
+
If you would like to examine the options available to you, you can use a debugging option provided by MSBuild to do so. Set the environment variable `MSBUILDEMITSOLUTION=1` and build your solution. This will produce an MSBuild file named *\<SolutionName>.sln.metaproj* that shows MSBuild's internal view of the solution at build time. You can inspect this view to determine what targets are available to build.
37
37
38
38
Do not build with this environment variable set unless you need this internal view. This setting can cause problems building projects in your solution.
Copy file name to clipboardExpand all lines: docs/msbuild/how-to-build-the-same-source-files-with-different-options.md
+11-11Lines changed: 11 additions & 11 deletions
Original file line number
Diff line number
Diff line change
@@ -16,11 +16,11 @@ manager: douge
16
16
ms.workload:
17
17
- "multiple"
18
18
---
19
-
# How to: Build the Same Source Files with Different Options
19
+
# How to: Build the same source files with different options
20
20
When you build projects, you frequently compile the same components with different build options. For example, you can create a debug build with symbol information or a release build with no symbol information but with optimizations enabled. Or you can build a project to run on a specific platform, such as x86 or [!INCLUDE[vcprx64](../extensibility/internals/includes/vcprx64_md.md)]. In all these cases, most of the build options stay the same; only a few options are changed to control the build configuration. With [!INCLUDE[vstecmsbuild](../extensibility/internals/includes/vstecmsbuild_md.md)], you use properties and conditions to create the different build configurations.
21
21
22
-
## Using Properties to Modify Projects
23
-
The `Property` element defines a variable that is referenced several times in a project file, such as the location of a temporary directory, or to set the values for properties that are used in several configurations, such as a Debug build and a Release build. For more information about properties, see [MSBuild Properties](../msbuild/msbuild-properties.md).
22
+
## Use properties to modify projects
23
+
The `Property` element defines a variable that is referenced several times in a project file, such as the location of a temporary directory, or to set the values for properties that are used in several configurations, such as a Debug build and a Release build. For more information about properties, see [MSBuild properties](../msbuild/msbuild-properties.md).
24
24
25
25
You can use properties to change the configuration of your build without having to change the project file. The `Condition` attribute of the `Property` element and the `PropertyGroup` element allows you to change the value of properties. For more information about [!INCLUDE[vstecmsbuild](../extensibility/internals/includes/vstecmsbuild_md.md)] conditions, see [Conditions](../msbuild/msbuild-conditions.md).
26
26
@@ -43,7 +43,7 @@ When you build projects, you frequently compile the same components with differe
Once your project file is written to accept multiple configurations, you need to have the ability to change those configurations whenever you build your project. [!INCLUDE[vstecmsbuild](../extensibility/internals/includes/vstecmsbuild_md.md)] provides this ability by allowing properties to be specified on the command line using the **/property** or **/p** switch.
48
48
49
49
#### To set a project property at the command line
@@ -54,7 +54,7 @@ When you build projects, you frequently compile the same components with differe
54
54
msbuild file.proj /property:Flavor=Debug
55
55
```
56
56
57
-
- or -
57
+
or
58
58
59
59
```cmd
60
60
Msbuild file.proj /p:Flavor=Debug
@@ -68,13 +68,13 @@ When you build projects, you frequently compile the same components with differe
68
68
msbuild file.proj /p:Flavor=Debug;Platform=x86
69
69
```
70
70
71
-
- or-
71
+
or
72
72
73
73
```cmd
74
74
msbuild file.proj /p:Flavor=Debug /p:Platform=x86
75
75
```
76
76
77
-
Environment variables are also treated as properties and are automatically incorporated by [!INCLUDE[vstecmsbuild](../extensibility/internals/includes/vstecmsbuild_md.md)]. For more information about using environment variables, see [How to: Use Environment Variables in a Build](../msbuild/how-to-use-environment-variables-in-a-build.md).
77
+
Environment variables are also treated as properties and are automatically incorporated by [!INCLUDE[vstecmsbuild](../extensibility/internals/includes/vstecmsbuild_md.md)]. For more information about using environment variables, see [How to: Use environment variables in a build](../msbuild/how-to-use-environment-variables-in-a-build.md).
78
78
79
79
The property value that is specified on the command line takes precedence over any value that is set for the same property in the project file, and that value in the project file takes precedence over the value in an environment variable.
Copy file name to clipboardExpand all lines: docs/msbuild/how-to-clean-a-build.md
+15-14Lines changed: 15 additions & 14 deletions
Original file line number
Diff line number
Diff line change
@@ -16,25 +16,26 @@ manager: douge
16
16
ms.workload:
17
17
- "multiple"
18
18
---
19
-
# How to: Clean a Build
20
-
When you clean a build, all intermediate and output files are deleted, leaving only the project and component files. From the project and component files, new instances of the intermediate and output files can then be built. The library of common tasks that is provided with [!INCLUDE[vstecmsbuild](../extensibility/internals/includes/vstecmsbuild_md.md)] includes an [Exec](../msbuild/exec-task.md) task that you can use to run system commands. For more information on the library of tasks, see [Task Reference](../msbuild/msbuild-task-reference.md).
19
+
# How to: Clean a build
20
+
When you clean a build, all intermediate and output files are deleted, leaving only the project and component files. From the project and component files, new instances of the intermediate and output files can then be built. The library of common tasks that is provided with [!INCLUDE[vstecmsbuild](../extensibility/internals/includes/vstecmsbuild_md.md)] includes an [Exec](../msbuild/exec-task.md) task that you can use to run system commands. For more information on the library of tasks, see [Task reference](../msbuild/msbuild-task-reference.md).
21
21
22
-
## Creating a Directory for Output Items
23
-
By default, the .exe file that is created when you compile a project is placed in the same directory as the project and source files. Typically, however, output items are created in a separate directory.
22
+
## Create a directory for output items
23
+
By default, the *.exe* file that is created when you compile a project is placed in the same directory as the project and source files. Typically, however, output items are created in a separate directory.
24
24
25
25
#### To create a directory for output items
26
26
27
-
1. Use the `Property` element to define the location and name of the directory. For example, create a directory named `BuiltApp` in the directory that contains the project and source files:
27
+
1. Use the `Property` element to define the location and name of the directory. For example, create a directory named *BuiltApp* in the directory that contains the project and source files:
28
28
29
29
`<builtdir>BuiltApp</builtdir>`
30
30
31
31
2. Use the [MakeDir](../msbuild/makedir-task.md) task to create the directory if the directory does not exist. For example:
32
32
33
-
`<MakeDir Directories = "$(builtdir)"`
33
+
```xml
34
+
<MakeDir Directories = "$(builtdir)"
35
+
Condition = "!Exists('$(builtdir)')" />
36
+
```
34
37
35
-
`Condition = "!Exists('$(builtdir)')" />`
36
-
37
-
## Removing the Output Items
38
+
## Remove the output items
38
39
Prior to creating new instances of intermediate and output files, you may want to clear all previous instances of intermediate and output files. Use the [RemoveDir](../msbuild/removedir-task.md) task to delete a directory and all files and directories that it contains from a disk.
39
40
40
41
#### To remove a directory and all files contained in the directory
@@ -94,9 +95,9 @@ When you clean a build, all intermediate and output files are deleted, leaving o
Copy file name to clipboardExpand all lines: docs/msbuild/how-to-configure-targets-and-tasks.md
+8-8Lines changed: 8 additions & 8 deletions
Original file line number
Diff line number
Diff line change
@@ -11,20 +11,20 @@ manager: douge
11
11
ms.workload:
12
12
- "multiple"
13
13
---
14
-
# How to: Configure Targets and Tasks
14
+
# How to: Configure targets and tasks
15
15
Selected MSBuild tasks can be set to run in the environment they target, regardless of the environment of the development computer. For example, when you use a 64-bit computer to build an application that targets a 32-bit architecture, selected tasks are run in a 32-bit process.
16
16
17
17
> [!NOTE]
18
18
> If a build task is written in a .NET language, such as Visual C# or Visual Basic, and does not use native resources or tools, then it will run in any target context without adaptation.
19
19
20
-
## UsingTask Attributes and Task Parameters
20
+
## UsingTask attributes and task parameters
21
21
The following `UsingTask` attributes affect all operations of a task in a particular build process:
22
22
23
23
- The `Runtime` attribute, if present, sets the common language runtime (CLR) version, and can take any one of these values: `CLR2`, `CLR4`, `CurrentRuntime`, or `*` (any runtime).
24
24
25
25
- The `Architecture` attribute, if present, sets the platform and bitness, and can take any one of these values: `x86`, `x64`, `CurrentArchitecture`, or `*` (any architecture).
26
26
27
-
- The `TaskFactory` attribute, if present, sets the task factory that creates and runs the task instance, and takes only the value `TaskHostFactory`. For more information, see the Task Factories section later in this document.
27
+
- The `TaskFactory` attribute, if present, sets the task factory that creates and runs the task instance, and takes only the value `TaskHostFactory`. For more information, see [Task factories](#task-factories) later in this document.
28
28
29
29
```xml
30
30
<UsingTaskTaskName="SimpleTask"
@@ -69,7 +69,7 @@ Selected MSBuild tasks can be set to run in the environment they target, regardl
69
69
70
70
```
71
71
72
-
## Task Factories
72
+
## Task factories
73
73
Before it runs a task, MSBuild checks to see whether it is designated to run in the current software context. If the task is so designated, MSBuild passes it to the AssemblyTaskFactory, which runs it in the current process; otherwise, MSBuild passes the task to the TaskHostFactory, which runs the task in a process that matches the target context. Even if the current context and the target context match, you can force a task to run out-of-process (for isolation, security, or other reasons) by setting `TaskFactory` to `TaskHostFactory`.
74
74
75
75
```xml
@@ -79,7 +79,7 @@ Selected MSBuild tasks can be set to run in the environment they target, regardl
79
79
</UsingTask>
80
80
```
81
81
82
-
## Phantom Task Parameters
82
+
## Phantom task parameters
83
83
Like any other task parameters, `MSBuildRuntime` and `MSBuildArchitecture` can be set from build properties.
84
84
85
85
```xml
@@ -101,7 +101,7 @@ Selected MSBuild tasks can be set to run in the environment they target, regardl
101
101
The `MSBuildRuntime` and `MSBuildArchitecture` parameters provide the most flexible way to set the target context, but also the most limited in scope. On the one hand, because they are set on the task instance itself and are not evaluated until the task is about to run, they can derive their value from the full scope of properties available at both evaluation-time and build-time. On the other hand, these parameters only apply to a particular instance of a task in a particular target.
102
102
103
103
> [!NOTE]
104
-
> Task parameters are evaluated in the context of the parent node, not in the context of the task host.Environment variables that are runtime- or architecture- dependent (such as the Program files location) will evaluate to the value that matches the parent node. However, if the same environment variable is read directly by the task, it will correctly be evaluated in the context of the task host.
104
+
> Task parameters are evaluated in the context of the parent node, not in the context of the task host.Environment variables that are runtime- or architecture- dependent (such as the *Program Files* location) will evaluate to the value that matches the parent node. However, if the same environment variable is read directly by the task, it will correctly be evaluated in the context of the task host.
105
105
106
-
## See Also
107
-
[Configuring Targets and Tasks](../msbuild/configuring-targets-and-tasks.md)
106
+
## See also
107
+
[Configure targets and tasks](../msbuild/configuring-targets-and-tasks.md)
Copy file name to clipboardExpand all lines: docs/msbuild/how-to-display-an-item-list-separated-with-commas.md
+6-6Lines changed: 6 additions & 6 deletions
Original file line number
Diff line number
Diff line change
@@ -14,15 +14,15 @@ manager: douge
14
14
ms.workload:
15
15
- "multiple"
16
16
---
17
-
# How to: Display an Item List Separated with Commas
17
+
# How to: Display an item list separated with commas
18
18
When you work with item lists in [!INCLUDE[vstecmsbuildengine](../msbuild/includes/vstecmsbuildengine_md.md)] ([!INCLUDE[vstecmsbuild](../extensibility/internals/includes/vstecmsbuild_md.md)]), it is sometimes useful to display the contents of those item lists in a way that is easy to read. Or, you might have a task that takes a list of items separated with a special separator string. In both of these cases, you can specify a separator string for an item list.
19
19
20
-
## Separating Items in a List with Commas
20
+
## Separate items in a list with commas
21
21
By default, [!INCLUDE[vstecmsbuild](../extensibility/internals/includes/vstecmsbuild_md.md)] uses semicolons to separate items in a list. For example, consider a `Message` element with the following value:
22
22
23
23
`<Message Text="This is my list of TXT files: @(TXTFile)"/>`
24
24
25
-
When the `@(TXTFile)` item list contains the items App1.txt, App2.txt, and App3.txt, the message is:
25
+
When the `@(TXTFile)` item list contains the items *App1.txt*, *App2.txt*, and *App3.txt*, the message is:
26
26
27
27
`This is my list of TXT files: App1.txt;App2.txt;App3.txt`
28
28
@@ -39,7 +39,7 @@ When you work with item lists in [!INCLUDE[vstecmsbuildengine](../msbuild/includ
39
39
`@(TXTFile, ', ')`
40
40
41
41
## Example
42
-
In this example, [Exec](../msbuild/exec-task.md) task runs the findstr tool to find specified text strings in the file, Phrases.txt. In the findstr command, literal search strings are indicated by the **/c:** switch, so the item separator, `/c:` is inserted between items in the `@(Phrase)` item list.
42
+
In this example, [Exec](../msbuild/exec-task.md) task runs the findstr tool to find specified text strings in the file, *Phrases.txt*. In the findstr command, literal search strings are indicated by the **/c:** switch, so the item separator, `/c:` is inserted between items in the `@(Phrase)` item list.
43
43
44
44
For this example, the equivalent command-line command is:
45
45
@@ -62,6 +62,6 @@ When you work with item lists in [!INCLUDE[vstecmsbuildengine](../msbuild/includ
0 commit comments