Skip to content

Commit 569df49

Browse files
authored
Merge pull request #2473 from v-thepet/msbuild1
MSBuild PR #6
2 parents 868eb69 + 382c40f commit 569df49

10 files changed

+115
-114
lines changed

docs/msbuild/how-to-build-specific-targets-in-solutions-by-using-msbuild-exe.md

Lines changed: 12 additions & 12 deletions
Original file line numberDiff line numberDiff line change
@@ -15,30 +15,30 @@ manager: douge
1515
ms.workload:
1616
- "multiple"
1717
---
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.
2020

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
2222

2323
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.
2424

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.
2626

2727
## 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.
2929

3030
```cmd
31-
msbuild SlnFolders.sln /target:NotInSlnfolder:Rebuild;NewFolder\InSolutionFolder:Clean`
31+
msbuild SlnFolders.sln /target:NotInSlnfolder:Rebuild;NewFolder\InSolutionFolder:Clean
3232
```
3333

3434
## Troubleshooting
3535

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.
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.
3737

3838
Do not build with this environment variable set unless you need this internal view. This setting can cause problems building projects in your solution.
3939

40-
## See Also
41-
[Command-Line Reference](../msbuild/msbuild-command-line-reference.md)
42-
[MSBuild Reference](../msbuild/msbuild-reference.md)
43-
[ MSBuild](../msbuild/msbuild.md)
44-
[MSBuild Concepts](../msbuild/msbuild-concepts.md)
40+
## See also
41+
[Command-line reference](../msbuild/msbuild-command-line-reference.md)
42+
[MSBuild reference](../msbuild/msbuild-reference.md)
43+
[MSBuild](../msbuild/msbuild.md)
44+
[MSBuild concepts](../msbuild/msbuild-concepts.md)

docs/msbuild/how-to-build-the-same-source-files-with-different-options.md

Lines changed: 11 additions & 11 deletions
Original file line numberDiff line numberDiff line change
@@ -16,11 +16,11 @@ manager: douge
1616
ms.workload:
1717
- "multiple"
1818
---
19-
# How to: Build the Same Source Files with Different Options
19+
# How to: Build the same source files with different options
2020
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.
2121

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).
2424

2525
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).
2626

@@ -43,7 +43,7 @@ When you build projects, you frequently compile the same components with differe
4343
<DebugType Condition="'$(Flavor)'=='DEBUG'">full</DebugType>
4444
```
4545

46-
## Specifying Properties on the Command Line
46+
## Specify properties on the command line
4747
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.
4848

4949
#### 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
5454
msbuild file.proj /property:Flavor=Debug
5555
```
5656

57-
- or -
57+
or
5858

5959
```cmd
6060
Msbuild file.proj /p:Flavor=Debug
@@ -68,13 +68,13 @@ When you build projects, you frequently compile the same components with differe
6868
msbuild file.proj /p:Flavor=Debug;Platform=x86
6969
```
7070

71-
- or-
71+
or
7272

7373
```cmd
7474
msbuild file.proj /p:Flavor=Debug /p:Platform=x86
7575
```
7676

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).
7878

7979
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.
8080

@@ -178,8 +178,8 @@ ToolsVersion="4.0" TreatAsLocalProperty="Color">
178178
-->
179179
```
180180

181-
## See Also
181+
## See also
182182
[MSBuild](../msbuild/msbuild.md)
183-
[MSBuild Concepts](../msbuild/msbuild-concepts.md)
184-
[MSBuild Reference](../msbuild/msbuild-reference.md)
185-
[Project Element (MSBuild)](../msbuild/project-element-msbuild.md)
183+
[MSBuild concepts](../msbuild/msbuild-concepts.md)
184+
[MSBuild reference](../msbuild/msbuild-reference.md)
185+
[Project element (MSBuild)](../msbuild/project-element-msbuild.md)

docs/msbuild/how-to-clean-a-build.md

Lines changed: 15 additions & 14 deletions
Original file line numberDiff line numberDiff line change
@@ -16,25 +16,26 @@ manager: douge
1616
ms.workload:
1717
- "multiple"
1818
---
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).
2121

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.
2424

2525
#### To create a directory for output items
2626

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:
2828

2929
`<builtdir>BuiltApp</builtdir>`
3030

3131
2. Use the [MakeDir](../msbuild/makedir-task.md) task to create the directory if the directory does not exist. For example:
3232

33-
`<MakeDir Directories = "$(builtdir)"`
33+
```xml
34+
<MakeDir Directories = "$(builtdir)"
35+
Condition = "!Exists('$(builtdir)')" />
36+
```
3437

35-
`Condition = "!Exists('$(builtdir)')" />`
36-
37-
## Removing the Output Items
38+
## Remove the output items
3839
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.
3940

4041
#### 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
9495
</Project>
9596
```
9697

97-
## See Also
98-
[Exec Task](../msbuild/exec-task.md)
99-
[MakeDir Task](../msbuild/makedir-task.md)
100-
[RemoveDir Task](../msbuild/removedir-task.md)
101-
[Csc Task](../msbuild/csc-task.md)
98+
## See also
99+
[Exec task](../msbuild/exec-task.md)
100+
[MakeDir task](../msbuild/makedir-task.md)
101+
[RemoveDir task](../msbuild/removedir-task.md)
102+
[Csc task](../msbuild/csc-task.md)
102103
[Targets](../msbuild/msbuild-targets.md)

docs/msbuild/how-to-configure-targets-and-tasks.md

Lines changed: 8 additions & 8 deletions
Original file line numberDiff line numberDiff line change
@@ -11,20 +11,20 @@ manager: douge
1111
ms.workload:
1212
- "multiple"
1313
---
14-
# How to: Configure Targets and Tasks
14+
# How to: Configure targets and tasks
1515
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.
1616

1717
> [!NOTE]
1818
> 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.
1919
20-
## UsingTask Attributes and Task Parameters
20+
## UsingTask attributes and task parameters
2121
The following `UsingTask` attributes affect all operations of a task in a particular build process:
2222

2323
- 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).
2424

2525
- The `Architecture` attribute, if present, sets the platform and bitness, and can take any one of these values: `x86`, `x64`, `CurrentArchitecture`, or `*` (any architecture).
2626

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.
2828

2929
```xml
3030
<UsingTask TaskName="SimpleTask"
@@ -69,7 +69,7 @@ Selected MSBuild tasks can be set to run in the environment they target, regardl
6969

7070
```
7171

72-
## Task Factories
72+
## Task factories
7373
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`.
7474

7575
```xml
@@ -79,7 +79,7 @@ Selected MSBuild tasks can be set to run in the environment they target, regardl
7979
</UsingTask>
8080
```
8181

82-
## Phantom Task Parameters
82+
## Phantom task parameters
8383
Like any other task parameters, `MSBuildRuntime` and `MSBuildArchitecture` can be set from build properties.
8484

8585
```xml
@@ -101,7 +101,7 @@ Selected MSBuild tasks can be set to run in the environment they target, regardl
101101
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.
102102

103103
> [!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.
105105
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)

docs/msbuild/how-to-display-an-item-list-separated-with-commas.md

Lines changed: 6 additions & 6 deletions
Original file line numberDiff line numberDiff line change
@@ -14,15 +14,15 @@ manager: douge
1414
ms.workload:
1515
- "multiple"
1616
---
17-
# How to: Display an Item List Separated with Commas
17+
# How to: Display an item list separated with commas
1818
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.
1919

20-
## Separating Items in a List with Commas
20+
## Separate items in a list with commas
2121
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:
2222

2323
`<Message Text="This is my list of TXT files: @(TXTFile)"/>`
2424

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:
2626

2727
`This is my list of TXT files: App1.txt;App2.txt;App3.txt`
2828

@@ -39,7 +39,7 @@ When you work with item lists in [!INCLUDE[vstecmsbuildengine](../msbuild/includ
3939
`@(TXTFile, ', ')`
4040

4141
## 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.
4343

4444
For this example, the equivalent command-line command is:
4545

@@ -62,6 +62,6 @@ When you work with item lists in [!INCLUDE[vstecmsbuildengine](../msbuild/includ
6262
</Project>
6363
```
6464

65-
## See Also
66-
[MSBuild Reference](../msbuild/msbuild-reference.md)
65+
## See also
66+
[MSBuild reference](../msbuild/msbuild-reference.md)
6767
[Items](../msbuild/msbuild-items.md)

0 commit comments

Comments
 (0)