Skip to content

Commit e93e296

Browse files
authored
Document MSBuild support for 'IfDifferent' for 'CopyToOutputDirectory' (#44060)
1 parent 1c23997 commit e93e296

File tree

1 file changed

+10
-1
lines changed

1 file changed

+10
-1
lines changed

docs/core/project-sdk/msbuild-props.md

+10-1
Original file line numberDiff line numberDiff line change
@@ -1783,7 +1783,16 @@ In addition to the standard [MSBuild item attributes](/visualstudio/msbuild/item
17831783

17841784
### CopyToPublishDirectory
17851785

1786-
The `CopyToPublishDirectory` metadata on an MSBuild item controls when the item is copied to the publish directory. Allowable values are `PreserveNewest`, which only copies the item if it has changed, `Always`, which always copies the item, and `Never`, which never copies the item. From a performance standpoint, `PreserveNewest` is preferable because it enables an incremental build.
1786+
The `CopyToPublishDirectory` metadata on an MSBuild item controls when the item is copied to the publish directory. The following table shows the allowable values.
1787+
1788+
| Value | Description |
1789+
| ------ | ------------ |
1790+
| `PreserveNewest` | Only copies the item if it has changed in the source location. |
1791+
| `IfDifferent` | Only copies the item if it has changed either in the source or target location. This setting is helpful for situations where you need to reset changes that occur after publishing. |
1792+
| `Always` | Always copies the item. |
1793+
| `Never` | Never copies the item. |
1794+
1795+
From a performance standpoint, `PreserveNewest` is preferable because it enables an incremental build. Avoid using `Always` and use `IfDifferent` instead, which avoids I/O writes with no effect.
17871796

17881797
```xml
17891798
<ItemGroup>

0 commit comments

Comments
 (0)