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-select-the-files-to-build.md
+20-20Lines changed: 20 additions & 20 deletions
Original file line number
Diff line number
Diff line change
@@ -15,10 +15,10 @@ manager: douge
15
15
ms.workload:
16
16
- "multiple"
17
17
---
18
-
# How to: Select the Files to Build
18
+
# How to: Select the files to build
19
19
When you build a project that contains several files, you can list each file separately in the project file, or you can use wildcards to include all the files in one directory or a nested set of directories.
20
20
21
-
## Specifying Inputs
21
+
## Specify inputs
22
22
Items represent the inputs for a build. For more information on items, see [Items](../msbuild/msbuild-items.md).
23
23
24
24
To include files for a build, they must be included in an item list in the [!INCLUDE[vstecmsbuild](../extensibility/internals/includes/vstecmsbuild_md.md)] project file. Multiple files can be added to item lists by either including the files individually or using wildcards to include many files at once.
@@ -29,7 +29,7 @@ When you build a project that contains several files, you can list each file sep
29
29
30
30
`<CSFile Include="form1.cs"/>`
31
31
32
-
- or -
32
+
or
33
33
34
34
`<VBFile Include="form1.vb"/>`
35
35
@@ -42,44 +42,44 @@ When you build a project that contains several files, you can list each file sep
42
42
43
43
`<CSFile Include="form1.cs;form2.cs"/>`
44
44
45
-
- or -
45
+
or
46
46
47
47
`<VBFile Include="form1.vb;form2.vb"/>`
48
48
49
-
## Specifying Inputs with Wildcards
49
+
## Specify inputs with wildcards
50
50
You can also use wildcards to recursively include all files or only specific files from subdirectories as inputs for a build. For more information about wildcards, see [Items](../msbuild/msbuild-items.md)
51
51
52
-
The following examples are based on a project that contains graphics files in the following directories and subdirectories, with the project file located in the Project directory:
52
+
The following examples are based on a project that contains graphics files in the following directories and subdirectories, with the project file located in the *Project* directory:
53
53
54
-
Project\Images\BestJpgs
54
+
*Project\Images\BestJpgs*
55
55
56
-
Project\Images\ImgJpgs
56
+
*Project\Images\ImgJpgs*
57
57
58
-
Project\Images\ImgJpgs\Img1
58
+
*Project\Images\ImgJpgs\Img1*
59
59
60
-
#### To include all .jpg files in the Images directory and subdirectories
60
+
#### To include all *.jpg* files in the *Images* directory and subdirectories
61
61
62
62
- Use the following `Include` attribute:
63
63
64
64
`Include="Images\**\*.jpg"`
65
65
66
-
#### To include all .jpg files starting with "img"
66
+
#### To include all *.jpg* files starting with *img*
67
67
68
68
- Use the following `Include` attribute:
69
69
70
70
`Include="Images\**\img*.jpg"`
71
71
72
-
#### To include all files in directories with names ending in "jpgs"
72
+
#### To include all files in directories with names ending in *jpgs*
73
73
74
74
- Use one of the following `Include` attributes:
75
75
76
76
`Include="Images\**\*jpgs\*.*"`
77
77
78
-
- or -
78
+
or
79
79
80
80
`Include="Images\**\*jpgs\*"`
81
81
82
-
## Passing Items to a Task
82
+
## Pass items to a task
83
83
In a project file, you can use the @() notation in tasks to specify an entire item list as the input for a build. You can use this notation whether you list all files separately or use wildcards.
84
84
85
85
#### To use all Visual C# or Visual Basic files as inputs
@@ -88,12 +88,12 @@ When you build a project that contains several files, you can list each file sep
88
88
89
89
`<CSC Sources="@(CSFile)">...</CSC>`
90
90
91
-
- or -
91
+
or
92
92
93
93
`<VBC Sources="@(VBFile)">...</VBC>`
94
94
95
95
> [!NOTE]
96
-
> You must use wildcards with items to specifiy the inputs for a build; you cannot specify the inputs using the `Sources` attribute in [!INCLUDE[vstecmsbuild](../extensibility/internals/includes/vstecmsbuild_md.md)] tasks such as [Csc](../msbuild/csc-task.md) or [Vbc](../msbuild/vbc-task.md). The following example is not valid in a project file:
96
+
> You must use wildcards with items to specify the inputs for a build; you cannot specify the inputs using the `Sources` attribute in [!INCLUDE[vstecmsbuild](../extensibility/internals/includes/vstecmsbuild_md.md)] tasks such as [Csc](../msbuild/csc-task.md) or [Vbc](../msbuild/vbc-task.md). The following example is not valid in a project file:
97
97
>
98
98
> `<CSC Sources="*.cs">...</CSC>`
99
99
@@ -132,7 +132,7 @@ When you build a project that contains several files, you can list each file sep
132
132
```
133
133
134
134
## Example
135
-
The following code example uses a wildcard to include all the .cs files.
135
+
The following code example uses a wildcard to include all the *.cs* files.
136
136
137
137
```xml
138
138
<ProjectDefaultTargets="Compile"
@@ -165,6 +165,6 @@ When you build a project that contains several files, you can list each file sep
165
165
</Project>
166
166
```
167
167
168
-
## See Also
169
-
[How to: Exclude Files from the Build](../msbuild/how-to-exclude-files-from-the-build.md)
170
-
[Items](../msbuild/msbuild-items.md)
168
+
## See also
169
+
[How to: Exclude files from the build](../msbuild/how-to-exclude-files-from-the-build.md)
Copy file name to clipboardExpand all lines: docs/msbuild/how-to-specify-which-target-to-build-first.md
+6-6Lines changed: 6 additions & 6 deletions
Original file line number
Diff line number
Diff line change
@@ -15,10 +15,10 @@ manager: douge
15
15
ms.workload:
16
16
- "multiple"
17
17
---
18
-
# How to: Specify Which Target to Build First
18
+
# How to: Specify which target to build first
19
19
A project file can contain one or more `Target` elements that define how the project is built. The [!INCLUDE[vstecmsbuildengine](../msbuild/includes/vstecmsbuildengine_md.md)] ([!INCLUDE[vstecmsbuild](../extensibility/internals/includes/vstecmsbuild_md.md)]) engine builds the first project it finds, and any dependencies, unless the project file contains a `DefaultTargets` attribute, an `InitialTargets` attribute, or a target is specified at the command line using the **/target** switch.
20
20
21
-
## Using the InitialTargets Attribute
21
+
## Use the InitialTargets attribute
22
22
The `InitialTargets` attribute of the `Project` element specifies a target that will run first, even if targets are specified on the command line or in the `DefaultTargets` attribute.
23
23
24
24
#### To specify one initial target
@@ -35,7 +35,7 @@ A project file can contain one or more `Target` elements that define how the pro
35
35
36
36
`<Project InitialTargets="Clean;Compile">`
37
37
38
-
## Using the DefaultTargets Attribute
38
+
## Use the DefaultTargets attribute
39
39
The `DefaultTargets` attribute of the `Project` element specifies which target or targets are built if a target is not specified explicitly on the command line. If targets are specified in both the `InitialTargets` and `DefaultTargets` attributes and no target is specified on the command line, [!INCLUDE[vstecmsbuild](../extensibility/internals/includes/vstecmsbuild_md.md)] runs the targets specified in the `InitialTargets` attribute followed by the targets specified in the `DefaultTargets` attribute.
40
40
41
41
#### To specify one default target
@@ -52,7 +52,7 @@ A project file can contain one or more `Target` elements that define how the pro
52
52
53
53
`<Project DefaultTargets="Clean;Compile">`
54
54
55
-
## Using the /target Switch
55
+
## Use the /target Switch
56
56
If a default target is not defined in the project file, or if you do not want to use that default target, you can use the command line switch **/target** to specify a different target. The target or targets specified with the **/target** switch are run instead of the targets specified by the `DefaultTargets` attribute. Targets specified in the `InitialTargets` attribute always run first.
57
57
58
58
#### To use a target other than the default target first
@@ -67,7 +67,7 @@ A project file can contain one or more `Target` elements that define how the pro
67
67
68
68
`msbuild <file name>.proj /t:Clean;Compile`
69
69
70
-
## See Also
70
+
## See also
71
71
[MSBuild](../msbuild/msbuild.md)
72
72
[Targets](../msbuild/msbuild-targets.md)
73
-
[How to: Clean a Build](../msbuild/how-to-clean-a-build.md)
73
+
[How to: Clean a build](../msbuild/how-to-clean-a-build.md)
Copy file name to clipboardExpand all lines: docs/msbuild/how-to-use-environment-variables-in-a-build.md
+6-6Lines changed: 6 additions & 6 deletions
Original file line number
Diff line number
Diff line change
@@ -15,10 +15,10 @@ manager: douge
15
15
ms.workload:
16
16
- "multiple"
17
17
---
18
-
# How to: Use Environment Variables in a Build
18
+
# How to: Use environment variables in a build
19
19
When you build projects, it is often necessary to set build options using information that is not in the project file or the files that comprise your project. This information is typically stored in environment variables.
20
20
21
-
## Referencing Environment Variables
21
+
## Reference environment variables
22
22
All environment variables are available to the [!INCLUDE[vstecmsbuildengine](../msbuild/includes/vstecmsbuildengine_md.md)] ([!INCLUDE[vstecmsbuild](../extensibility/internals/includes/vstecmsbuild_md.md)]) project file as properties.
23
23
24
24
> [!NOTE]
@@ -34,7 +34,7 @@ When you build projects, it is often necessary to set build options using inform
34
34
35
35
#### To provide a default value for a property
36
36
37
-
- Use a `Condition` attribute on a property to set the value only if the property has no value. For example, the following code sets the `ToolsPath` property to c:\tools only if the `ToolsPath` environment variable is not set:
37
+
- Use a `Condition` attribute on a property to set the value only if the property has no value. For example, the following code sets the `ToolsPath` property to *c:\tools* only if the `ToolsPath` environment variable is not set:
Copy file name to clipboardExpand all lines: docs/msbuild/how-to-use-project-sdk.md
+9-9Lines changed: 9 additions & 9 deletions
Original file line number
Diff line number
Diff line change
@@ -12,7 +12,7 @@ manager: douge
12
12
ms.workload:
13
13
- "multiple"
14
14
---
15
-
# How to: Use MSBuild Project SDKs
15
+
# How to: Use MSBuild project SDKs
16
16
17
17
[!INCLUDE[vstecmsbuild](../extensibility/internals/includes/vstecmsbuild_md.md)] 15.0 introduced the concept of the "project SDK", which simplifies using software development kits that require properties and targets to be imported.
18
18
@@ -40,9 +40,9 @@ During evaluation of the project, [!INCLUDE[vstecmsbuild](../extensibility/inter
40
40
</Project>
41
41
```
42
42
43
-
## Referencing a Project SDK
43
+
## Reference a project SDK
44
44
45
-
There are three ways to reference a project SDK
45
+
There are three ways to reference a project SDK:
46
46
47
47
1. Use the `Sdk` attribute on the `<Project/>` element:
48
48
@@ -82,7 +82,7 @@ During evaluation of the project, [!INCLUDE[vstecmsbuild](../extensibility/inter
82
82
83
83
When using the `<Import/>` element, you can specify an optional `Version` attribute as well. For example, you can specify `<Import Project="Sdk.props" Sdk="My.Custom.Sdk" Version="1.2.3" />`.
84
84
85
-
## How Project SDKs are Resolved
85
+
## How project SDKs are resolved
86
86
87
87
When evaluating the import, [!INCLUDE[vstecmsbuild](../extensibility/internals/includes/vstecmsbuild_md.md)] dynamically resolves the path to the project SDK based on the name and version you specified. [!INCLUDE[vstecmsbuild](../extensibility/internals/includes/vstecmsbuild_md.md)] also has a list of registered SDK resolvers which are plug-ins that locate project SDKs on your machine. These plug-ins include:
88
88
@@ -103,11 +103,11 @@ The NuGet-based SDK resolver supports specifying a version in your [global.json]
103
103
}
104
104
```
105
105
106
-
Only one version of each project SDK can be used during a build. If you are referencing two different versions of the same project SDK, MSBuild will emit a warning. It is recommended to **not** specify a version in your projects if a version is specified in your `global.json`.
106
+
Only one version of each project SDK can be used during a build. If you are referencing two different versions of the same project SDK, MSBuild will emit a warning. It is recommended to **not** specify a version in your projects if a version is specified in your *global.json*.
Copy file name to clipboardExpand all lines: docs/msbuild/how-to-use-reserved-xml-characters-in-project-files.md
+4-4Lines changed: 4 additions & 4 deletions
Original file line number
Diff line number
Diff line change
@@ -14,10 +14,10 @@ manager: douge
14
14
ms.workload:
15
15
- "multiple"
16
16
---
17
-
# How to: Use Reserved XML Characters in Project Files
17
+
# How to: Use reserved XML characters in project files
18
18
When you author project files, you might need to use reserved XML characters, for example, in property values or in task parameter values. However, some reserved characters must be replaced by a named entity so that the project file can be parsed.
19
19
20
-
## Using Reserved Characters
20
+
## Use reserved characters
21
21
The following table describes the reserved XML characters that must be replaced by the corresponding named entity so that the project file can be parsed.
22
22
23
23
|Reserved character|Named entity|
@@ -66,6 +66,6 @@ When you author project files, you might need to use reserved XML characters, fo
Copy file name to clipboardExpand all lines: docs/msbuild/how-to-use-the-same-target-in-multiple-project-files.md
+11-11Lines changed: 11 additions & 11 deletions
Original file line number
Diff line number
Diff line change
@@ -14,11 +14,11 @@ manager: douge
14
14
ms.workload:
15
15
- "multiple"
16
16
---
17
-
# How to: Use the Same Target in Multiple Project Files
17
+
# How to: Use the same target in multiple project files
18
18
If you have authored several [!INCLUDE[vstecmsbuild](../extensibility/internals/includes/vstecmsbuild_md.md)] project files, you might have discovered that you need to use the same tasks and targets in different project files. Instead of including the complete description of those tasks or targets in every project file, you can save a target in a separate project file and then import that project into any other project that needs to use the target.
19
19
20
-
## Using the Import Element
21
-
The `Import` element is used to insert one project file into another project file. The project file that is being imported must be a valid [!INCLUDE[vstecmsbuild](../extensibility/internals/includes/vstecmsbuild_md.md)] project file and contain well-formed XML. The `Project` attribute specifies the path to the imported project file. For more information on the `Import` element, see [Import Element (MSBuild)](../msbuild/import-element-msbuild.md).
20
+
## Use the Import element
21
+
The `Import` element is used to insert one project file into another project file. The project file that is being imported must be a valid [!INCLUDE[vstecmsbuild](../extensibility/internals/includes/vstecmsbuild_md.md)] project file and contain well-formed XML. The `Project` attribute specifies the path to the imported project file. For more information on the `Import` element, see [Import element (MSBuild)](../msbuild/import-element-msbuild.md).
22
22
23
23
#### To import a project
24
24
@@ -30,10 +30,10 @@ If you have authored several [!INCLUDE[vstecmsbuild](../extensibility/internals/
30
30
31
31
3. Following the `Import` element, define all properties and items that must override default definitions of properties and items in the imported project.
32
32
33
-
## Order of Evaluation
33
+
## Order of evaluation
34
34
When [!INCLUDE[vstecmsbuild](../extensibility/internals/includes/vstecmsbuild_md.md)] reaches an `Import` element, the imported project is effectively inserted into the importing project at the location of the `Import` element. Therefore, the location of the `Import` element can affect the values of properties and items. It is important to understand the properties and items that are set by the imported project, and the properties and items that the imported project uses.
35
35
36
-
When the project builds, all properties are evaluated first, followed by items. For example, the following XML defines the imported project file MyCommon.targets:
36
+
When the project builds, all properties are evaluated first, followed by items. For example, the following XML defines the imported project file *MyCommon.targets*:
@@ -47,7 +47,7 @@ If you have authored several [!INCLUDE[vstecmsbuild](../extensibility/internals/
47
47
</Project>
48
48
```
49
49
50
-
The following XML defines MyApp.proj, which imports MyCommon.targets:
50
+
The following XML defines *MyApp.proj*, which imports *MyCommon.targets*:
51
51
52
52
```xml
53
53
<Project
@@ -64,7 +64,7 @@ If you have authored several [!INCLUDE[vstecmsbuild](../extensibility/internals/
64
64
65
65
`Name="MyCommon"`
66
66
67
-
Because the project is imported after the property `Name` has been defined in MyApp.proj, the definition of `Name` in MyCommon.targets overrides the definition in MyApp.proj. If, the project is imported before the property Name is defined, the build would display the following message:
67
+
Because the project is imported after the property `Name` has been defined in *MyApp.proj*, the definition of `Name` in *MyCommon.targets* overrides the definition in *MyApp.proj*. If the project is imported before the property Name is defined, the build would display the following message:
68
68
69
69
`Name="MyApp"`
70
70
@@ -77,7 +77,7 @@ If you have authored several [!INCLUDE[vstecmsbuild](../extensibility/internals/
77
77
3. Define in the project file all properties and items that must override default definitions of properties and items in the imported project.
78
78
79
79
## Example
80
-
The following code example shows the MyCommon.targets file that the second code example imports. The .targets file evaluates properties from the importing project to configure the build.
80
+
The following code example shows the *MyCommon.targets* file that the second code example imports. The *.targets* file evaluates properties from the importing project to configure the build.
0 commit comments