Skip to content

Commit aed8f2f

Browse files
authored
Merge pull request #3040 from Mikejo5000/mikejo-br13
xplat work for MSBuild
2 parents e3c7344 + c2df0fd commit aed8f2f

24 files changed

+130
-127
lines changed

docs/msbuild/build-loggers.md

Lines changed: 6 additions & 6 deletions
Original file line numberDiff line numberDiff line change
@@ -37,25 +37,25 @@ Loggers provide a way for you to customize the output of your build and display
3737
[!code-csharp[msbuild_SimpleConsoleLogger#3](../msbuild/codesnippet/CSharp/build-loggers_2.cs)]
3838

3939
## Respond to logger verbosity values
40-
In some cases, you may want to only log information from an event if the MSBuild.exe **/verbosity** switch contains a certain value. In this example, the <xref:Microsoft.Build.Framework.IEventSource.TargetStarted> event handler only logs a message if the <xref:Microsoft.Build.Utilities.Logger.Verbosity%2A> property, which is set by the **/verbosity** switch, is equal to <xref:Microsoft.Build.Framework.LoggerVerbosity>`Detailed`.
40+
In some cases, you may want to only log information from an event if the MSBuild.exe **-verbosity** switch contains a certain value. In this example, the <xref:Microsoft.Build.Framework.IEventSource.TargetStarted> event handler only logs a message if the <xref:Microsoft.Build.Utilities.Logger.Verbosity%2A> property, which is set by the **-verbosity** switch, is equal to <xref:Microsoft.Build.Framework.LoggerVerbosity>`Detailed`.
4141

4242
[!code-csharp[msbuild_SimpleConsoleLogger#4](../msbuild/codesnippet/CSharp/build-loggers_3.cs)]
4343

4444
## Specify a logger
45-
Once the logger is compiled into an assembly, you need to tell [!INCLUDE[vstecmsbuild](../extensibility/internals/includes/vstecmsbuild_md.md)] to use that logger during builds. This is done using the **/logger** switch with *MSBuild.exe*. For more information on the switches available for *MSBuild.exe*, see [Command-line reference](../msbuild/msbuild-command-line-reference.md).
45+
Once the logger is compiled into an assembly, you need to tell [!INCLUDE[vstecmsbuild](../extensibility/internals/includes/vstecmsbuild_md.md)] to use that logger during builds. This is done using the **-logger** switch with *MSBuild.exe*. For more information on the switches available for *MSBuild.exe*, see [Command-line reference](../msbuild/msbuild-command-line-reference.md).
4646

47-
The following command line builds the project *MyProject.csproj* and uses the logger class implemented in *SimpleLogger.dll*. The **/nologo** switch hides the banner and copyright message and the **/noconsolelogger** switch disables the default [!INCLUDE[vstecmsbuild](../extensibility/internals/includes/vstecmsbuild_md.md)] console logger.
47+
The following command line builds the project *MyProject.csproj* and uses the logger class implemented in *SimpleLogger.dll*. The **-nologo** switch hides the banner and copyright message and the **-noconsolelogger** switch disables the default [!INCLUDE[vstecmsbuild](../extensibility/internals/includes/vstecmsbuild_md.md)] console logger.
4848

4949
```cmd
50-
MSBuild /nologo /noconsolelogger /logger:SimpleLogger.dll
50+
MSBuild -nologo -noconsolelogger -logger:SimpleLogger.dll
5151
```
5252

5353
The following command line builds the project with the same logger, but with a `Verbosity` level of `Detailed`.
5454

5555
```cmd
56-
MSBuild /nologo /noconsolelogger /logger:SimpleLogger.dll /verbosity:Detailed
56+
MSBuild -nologo -noconsolelogger -logger:SimpleLogger.dll -verbosity:Detailed
5757
```
58-
58+
5959
## Example
6060

6161
### Description

docs/msbuild/building-multiple-projects-in-parallel-with-msbuild.md

Lines changed: 8 additions & 8 deletions
Original file line numberDiff line numberDiff line change
@@ -18,28 +18,28 @@ ms.workload:
1818
# Build multiple projects in parallel with MSBuild
1919
You can use MSBuild to build multiple projects faster by running them in parallel. To run builds in parallel, you use the following settings on a multi-core or multiple processor computer:
2020

21-
- The `/maxcpucount` switch at a command prompt.
21+
- The `-maxcpucount` switch at a command prompt.
2222

2323
- The <xref:Microsoft.Build.Tasks.MSBuild.BuildInParallel%2A> task parameter on an MSBuild task.
2424

2525
> [!NOTE]
26-
> The **/verbosity** (**/v**) switch in a command line can also affect build performance. Your build performance might decrease if the verbosity of your build log information is set to detailed or diagnostic, which are used for troubleshooting. For more information, see [Obtain build logs](../msbuild/obtaining-build-logs-with-msbuild.md) and [Command-line reference](../msbuild/msbuild-command-line-reference.md).
26+
> The **-verbosity** (**-v**) switch in a command line can also affect build performance. Your build performance might decrease if the verbosity of your build log information is set to detailed or diagnostic, which are used for troubleshooting. For more information, see [Obtain build logs](../msbuild/obtaining-build-logs-with-msbuild.md) and [Command-line reference](../msbuild/msbuild-command-line-reference.md).
2727
28-
## /maxcpucount Switch
29-
If you use the `/maxcpucount` switch, or `/m` for short, MSBuild can create the specified number of *MSBuild.exe* processes that may be run in parallel. These processes are also known as "worker processes." Each worker process uses a separate core or processor, if any are available, to build a project at the same time as other available processors may be building other projects. For example, setting this switch to a value of "4" causes MSBuild to create four worker processes to build the project.
28+
## -maxcpucount Switch
29+
If you use the `-maxcpucount` switch, or `-m` for short, MSBuild can create the specified number of *MSBuild.exe* processes that may be run in parallel. These processes are also known as "worker processes." Each worker process uses a separate core or processor, if any are available, to build a project at the same time as other available processors may be building other projects. For example, setting this switch to a value of "4" causes MSBuild to create four worker processes to build the project.
3030

31-
If you include the `/maxcpucount` switch without specifying a value, MSBuild will use up to the number of processors on the computer.
31+
If you include the `-maxcpucount` switch without specifying a value, MSBuild will use up to the number of processors on the computer.
3232

3333
For more information about this switch, which was introduced in MSBuild 3.5, see [Command-line reference](../msbuild/msbuild-command-line-reference.md).
3434

3535
The following example instructs MSBuild to use three worker processes. If you use this configuration, MSBuild can build three projects at the same time.
3636

3737
```cmd
38-
msbuild.exe myproj.proj /maxcpucount:3
38+
msbuild.exe myproj.proj -maxcpucount:3
3939
```
40-
40+
4141
## BuildInParallel task parameter
42-
`BuildInParallel` is an optional boolean parameter on a [!INCLUDE[vstecmsbuild](../extensibility/internals/includes/vstecmsbuild_md.md)] task. When `BuildInParallel` is set to `true` (its default value is `false`), multiple worker processes are generated to build as many projects at the same time as possible. For this to work correctly, the `/maxcpucount` switch must be set to a value greater than 1, and the system must be at least dual-core or have two or more processors.
42+
`BuildInParallel` is an optional boolean parameter on a [!INCLUDE[vstecmsbuild](../extensibility/internals/includes/vstecmsbuild_md.md)] task. When `BuildInParallel` is set to `true` (its default value is `false`), multiple worker processes are generated to build as many projects at the same time as possible. For this to work correctly, the `-maxcpucount` switch must be set to a value greater than 1, and the system must be at least dual-core or have two or more processors.
4343

4444
The following is an example, taken from *microsoft.common.targets*, about how to set the `BuildInParallel` parameter.
4545

docs/msbuild/common-msbuild-project-properties.md

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -42,14 +42,14 @@ The following table lists frequently used properties that are defined in the Vis
4242
|BaseOutputPath|Specifies the base path for the output file. If it is set, [!INCLUDE[vstecmsbuild](../extensibility/internals/includes/vstecmsbuild_md.md)] will use `OutputPath = $(BaseOutputPath)\$(Configuration)\`. Example syntax: `<BaseOutputPath>c:\xyz\bin\</BaseOutputPath>`|
4343
|BaseIntermediateOutputPath|The top-level folder where all configuration-specific intermediate output folders are created. The default value is `obj\`. The following code is an example: `<BaseIntermediateOutputPath>c:\xyz\obj\</BaseIntermediateOutputPath>`|
4444
|BuildInParallel|A boolean value that indicates whether project references are built or cleaned in parallel when Multi-Proc [!INCLUDE[vstecmsbuild](../extensibility/internals/includes/vstecmsbuild_md.md)] is used. The default value is `true`, which means that projects will be built in parallel if the system has multiple cores or processors.|
45-
|BuildProjectReferences|A boolean value that indicates whether project references are built by [!INCLUDE[vstecmsbuild](../extensibility/internals/includes/vstecmsbuild_md.md)]. Automatically set to `false` if you are building your project in the [!INCLUDE[vsprvs](../code-quality/includes/vsprvs_md.md)] integrated development environment (IDE), `true` if otherwise. `/p:BuildProjectReferences=false` can be specified on the command line to avoid checking that referenced projects are up to date.|
45+
|BuildProjectReferences|A boolean value that indicates whether project references are built by [!INCLUDE[vstecmsbuild](../extensibility/internals/includes/vstecmsbuild_md.md)]. Automatically set to `false` if you are building your project in the [!INCLUDE[vsprvs](../code-quality/includes/vsprvs_md.md)] integrated development environment (IDE), `true` if otherwise. `-p:BuildProjectReferences=false` can be specified on the command line to avoid checking that referenced projects are up to date.|
4646
|CleanFile|The name of the file that will be used as the "clean cache." The clean cache is a list of generated files to be deleted during the cleaning operation. The file is put in the intermediate output path by the build process.<br /><br /> This property specifies only file names that do not have path information.|
4747
|CodePage|Specifies the code page to use for all source-code files in the compilation. This property is equivalent to the `/codepage` compiler switch.|
4848
|CompilerResponseFile|An optional response file that can be passed to the compiler tasks.|
4949
|Configuration|The configuration that you are building, either "Debug" or "Release."|
5050
|CscToolPath|The path of *csc.exe*, the [!INCLUDE[csprcs](../data-tools/includes/csprcs_md.md)] compiler.|
5151
|CustomBeforeMicrosoftCommonTargets|The name of a project file or targets file that is to be imported automatically before the common targets import.|
52-
|DebugSymbols|A boolean value that indicates whether symbols are generated by the build.<br /><br /> Setting **/p:DebugSymbols=false** on the command line disables generation of program database (*.pdb*) symbol files.|
52+
|DebugSymbols|A boolean value that indicates whether symbols are generated by the build.<br /><br /> Setting **-p:DebugSymbols=false** on the command line disables generation of program database (*.pdb*) symbol files.|
5353
|DefineConstants|Defines conditional compiler constants. Symbol/value pairs are separated by semicolons and are specified by using the following syntax:<br /><br /> *symbol1 = value1 ; symbol2 = value2*<br /><br /> The property is equivalent to the `/define` compiler switch.|
5454
|DefineDebug|A boolean value that indicates whether you want the DEBUG constant defined.|
5555
|DefineTrace|A boolean value that indicates whether you want the TRACE constant defined.|

docs/msbuild/creating-forwarding-loggers.md

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -29,7 +29,7 @@ Forwarding loggers improve logging efficiency by letting you choose the events y
2929
In a multi-processor environment, event messages are likely to be received out of order. Therefore, you must evaluate the events by using the event handler in the forwarding logger and program it to determine which events to pass to the redirector for forwarding to the central logger. To accomplish this, you can use the <xref:Microsoft.Build.Framework.BuildEventContext> class, which is attached to every message, to help identify events you want to forward, and then pass the names of the events to the <xref:Microsoft.Build.BuildEngine.ConfigurableForwardingLogger> class (or a subclass of it). When you use this method, no other specific coding is required to forward events.
3030

3131
## Specify a forwarding logger
32-
After the forwarding logger has been compiled into an assembly, you must tell [!INCLUDE[vstecmsbuild](../extensibility/internals/includes/vstecmsbuild_md.md)] to use it during builds. To do this, use the `/FileLogger`, `/FileLoggerParameters`, and `/DistributedFileLogger` switches together with *MSBuild.exe*. The `/FileLogger` switch tells *MSBuild.exe* that the logger is directly attached. The `/DistributedFileLogger` switch means that there is a log file per node. To set parameters on the forwarding logger, use the `/FileLoggerParameters` switch. For more information about these and other *MSBuild.exe* switches, see [Command-line reference](../msbuild/msbuild-command-line-reference.md).
32+
After the forwarding logger has been compiled into an assembly, you must tell [!INCLUDE[vstecmsbuild](../extensibility/internals/includes/vstecmsbuild_md.md)] to use it during builds. To do this, use the `-FileLogger`, `-FileLoggerParameters`, and `-DistributedFileLogger` switches together with *MSBuild.exe*. The `-FileLogger` switch tells *MSBuild.exe* that the logger is directly attached. The `-DistributedFileLogger` switch means that there is a log file per node. To set parameters on the forwarding logger, use the `-FileLoggerParameters` switch. For more information about these and other *MSBuild.exe* switches, see [Command-line reference](../msbuild/msbuild-command-line-reference.md).
3333

3434
## Multi-processor-aware loggers
3535
When you build a project on a multi-processor system, the build messages from each processor are not automatically interleaved in a unified sequence. Instead, you must establish a message grouping priority by using the <xref:Microsoft.Build.Framework.BuildEventContext> class that is attached to every message. For more information about multi-processor building, see [Logging in a multi-processor environment](../msbuild/logging-in-a-multi-processor-environment.md).

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

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -22,13 +22,13 @@ You can use *MSBuild.exe* to build specific targets of specific projects in a so
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
2828
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

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

Lines changed: 10 additions & 10 deletions
Original file line numberDiff line numberDiff line change
@@ -44,34 +44,34 @@ When you build projects, you frequently compile the same components with differe
4444
```
4545

4646
## Specify properties on the command line
47-
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.
47+
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
5050

51-
- Use the **/property** switch with the property and property value. For example:
51+
- Use the **-property** switch with the property and property value. For example:
5252

5353
```cmd
54-
msbuild file.proj /property:Flavor=Debug
54+
msbuild file.proj -property:Flavor=Debug
5555
```
5656

5757
or
5858

5959
```cmd
60-
Msbuild file.proj /p:Flavor=Debug
60+
Msbuild file.proj -p:Flavor=Debug
6161
```
6262

6363
#### To specify more than one project property at the command line
6464

65-
- Use the **/property** or **/p** switch multiple times with the property and property values, or use one **/property** or **/p** switch and separate multiple properties with semicolons (;). For example:
65+
- Use the **-property** or **-p** switch multiple times with the property and property values, or use one **-property** or **-p** switch and separate multiple properties with semicolons (;). For example:
6666

6767
```cmd
68-
msbuild file.proj /p:Flavor=Debug;Platform=x86
68+
msbuild file.proj -p:Flavor=Debug;Platform=x86
6969
```
7070

7171
or
7272

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

7777
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).
@@ -86,13 +86,13 @@ When you build projects, you frequently compile the same components with differe
8686
To build the debug version of this project, type:
8787

8888
```cmd
89-
msbuild consolehwcs1.proj /p:flavor=debug
89+
msbuild consolehwcs1.proj -p:flavor=debug
9090
```
9191

9292
To build the retail version of this project, type:
9393

9494
```cmd
95-
msbuild consolehwcs1.proj /p:flavor=retail
95+
msbuild consolehwcs1.proj -p:flavor=retail
9696
```
9797

9898
```xml
@@ -153,7 +153,7 @@ msbuild consolehwcs1.proj /p:flavor=retail
153153
To build the project, enter the following command:
154154

155155
```cmd
156-
msbuild colortest.proj /t:go /property:Color=Green
156+
msbuild colortest.proj -t:go -property:Color=Green
157157
```
158158

159159
```xml

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

Lines changed: 4 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -47,13 +47,13 @@ When you clean a build, all intermediate and output files are deleted, leaving o
4747
## Example
4848
The following code example project contains a new target, `Clean`, that uses the `RemoveDir` task to delete a directory and all files and directories that it contains. Also in this example, the `Compile` target creates a separate directory for the output items that are deleted when the build is cleaned.
4949

50-
`Compile` is defined as the default target and is therefore used automatically unless you specify a different target or targets. You use the command line switch **/target** to specify a different target. For example:
50+
`Compile` is defined as the default target and is therefore used automatically unless you specify a different target or targets. You use the command line switch **-target** to specify a different target. For example:
5151

52-
`msbuild <file name>.proj /target:Clean`
52+
`msbuild <file name>.proj -target:Clean`
5353

54-
The **/target** switch can be shortened to **/t** and can specify more than one target. For example, to use the target `Clean` then the target `Compile`, type:
54+
The **-target** switch can be shortened to **-t** and can specify more than one target. For example, to use the target `Clean` then the target `Compile`, type:
5555

56-
`msbuild <file name>.proj /t:Clean;Compile`
56+
`msbuild <file name>.proj -t:Clean;Compile`
5757

5858
```xml
5959
<Project DefaultTargets = "Compile"

0 commit comments

Comments
 (0)