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/incremental-builds.md
+7-7Lines changed: 7 additions & 7 deletions
Original file line number
Diff line number
Diff line change
@@ -16,7 +16,7 @@ ms.workload:
16
16
# Incremental builds
17
17
Incremental builds are builds that are optimized so that targets that have output files that are up-to-date with respect to their corresponding input files are not executed. A target element can have both an `Inputs` attribute, which indicates what items the target expects as input, and an `Outputs` attribute, which indicates what items it produces as output. MSBuild attempts to find a 1-to-1 mapping between the values of these attributes. If a 1-to-1 mapping exists, MSBuild compares the time stamp of every input item to the time stamp of its corresponding output item. Output files that have no 1-to-1 mapping are compared to all input files. An item is considered up-to-date if its output file is the same age or newer than its input file or files.
18
18
19
-
If all output items are up-to-date, MSBuild skips the target. This *incremental build* of the target can significantly improve the build speed. If only some files are up-to-date, MSBuild executes the target but skips the up-to-date items, and thereby brings all items up-to-date. This is known as a *partial incremental build*.
19
+
If all output items are up-to-date, MSBuild skips the target. This *incremental build* of the target can significantly improve the build speed. If only some files are up-to-date, MSBuild executes the target but skips the up-to-date items, and thereby brings all items up-to-date. This process is known as a *partial incremental build*.
20
20
21
21
1-to-1 mappings are typically produced by item transformations. For more information, see [Transforms](../msbuild/msbuild-transforms.md).
22
22
@@ -30,16 +30,16 @@ Incremental builds are builds that are optimized so that targets that have outpu
30
30
</Target>
31
31
```
32
32
33
-
The set of files represented by the `Compile` item type are copied to a backup directory. The backup files have the *.bak* file name extension. If the files represented by the `Compile` item type, or the corresponding backup files, are not deleted or modified after the Backup target is run, then the Backup target is skipped in subsequent builds.
33
+
The set of files represented by the `Compile` item type is copied to a backup directory. The backup files have the *.bak* file name extension. If the files represented by the `Compile` item type, or the corresponding backup files, are not deleted or modified after the Backup target is run, then the Backup target is skipped in subsequent builds.
34
34
35
35
## Output inference
36
-
MSBuild compares the `Inputs` and `Outputs` attributes of a target to determine whether the target has to execute. Ideally, the set of files that exists after an incremental build is completed should remain the same whether or not the associated targets are executed. Because properties and items that are created or altered by tasks can affect the build, MSBuild must infer their values even if the target that affects them is skipped. This is known as *output inference*.
36
+
MSBuild compares the `Inputs` and `Outputs` attributes of a target to determine whether the target has to execute. Ideally, the set of files that exists after an incremental build is completed should remain the same whether or not the associated targets are executed. Because properties and items that are created or altered by tasks can affect the build, MSBuild must infer their values even if the target that affects them is skipped. This process is known as *output inference*.
37
37
38
38
There are three cases:
39
39
40
40
- The target has a `Condition` attribute that evaluates to `false`. In this case, the target is not run, and has no effect on the build.
41
41
42
-
- The target has out-of-date outputs and is run to bring them up to date.
42
+
- The target has out-of-date outputs and is run to bring them up-to-date.
43
43
44
44
- The target has no out-of-date outputs and is skipped. MSBuild evaluates the target and makes changes to items and properties as if the target had been run.
45
45
@@ -51,15 +51,15 @@ To support incremental compilation, tasks must ensure that the `TaskParameter` a
51
51
</CreateProperty>
52
52
```
53
53
54
-
This creates the property Easy, which has the value "123" whether or not the target is executed or skipped.
54
+
This code creates the property Easy, which has the value "123" whether or not the target is executed or skipped.
This creates the item type Simple, which has two items, *a.cs* and *b.cs*, whether or not the target is executed or skipped.
62
+
This code creates the item type Simple, which has two items, *a.cs* and *b.cs*, whether or not the target is executed or skipped.
63
63
64
64
Starting in MSBuild 3.5, output inference is performed automatically on item and property groups in a target. `CreateItem` tasks are not required in a target and should be avoided. Also, `CreateProperty` tasks should be used in a target only to determine whether a target has been executed.
65
65
@@ -72,7 +72,7 @@ To support incremental compilation, tasks must ensure that the `TaskParameter` a
72
72
</CreateProperty>
73
73
```
74
74
75
-
This creates the property CompileRan and gives it the value `true`, but only if the target is executed. If the target is skipped, CompileRan is not created.
75
+
This code creates the property CompileRan and gives it the value `true`, but only if the target is executed. If the target is skipped, CompileRan is not created.
0 commit comments