dotnet / dotnet/project-system
ItemDefinition is not used for Content node
- Dominant language
- C#
- Stars
- 1k
- Forks
- 415
- PR merge metrics
- No merged PRs in 30d
Description
**Visual Studio Version**:
Microsoft Visual Studio Community 2019
Version 16.8.3
VisualStudio.16.Release/16.8.3+30804.86
Microsoft .NET Framework
Version 4.8.03752
Installed Version: Community
C# Tools 3.8.0-5.20604.10+9ed4b774d20940880de8df1ca8b07508aa01c8cd
C# components used in the IDE. Depending on your project type and settings, a different version of the compiler may be used.
NuGet Package Manager 5.8.0
NuGet Package Manager in Visual Studio. For more information about NuGet, visit https://docs.nuget.org/
Other tools are most likely irrelevant and removed for the sake of brevity.
**Summary**:
If project file contains `ItemDefinition` for `Content` node, it will be used as expected by msbuild, but won't be respected by Visual Studio.
```
PreserveNewest
```
**Steps to Reproduce**:
1. Create project with `ItemDefinitionGroup` mentioned above
2. Add any `Content` node without explicitly setting `CopyToOutput` directory to it
3. Check out items properties in Solution Explorer – `CopyToOutputDirectory` is `None`. Build project – item won't be copied.
**Expected Behavior**:
Item has `CopyToOutputDirectory` equal to `PreserveNewest` and is copied to output directory on build.
**Actual Behavior**:
Item is not copied.
**Sample solution**
[ContentItemDefinition.zip](https://github.com/dotnet/project-system/files/5931450/ContentItemDefinition.zip)
**User Impact**:
Users are forced to explicitly specify `PreserveNewest` on every `Content` item they add to the project.
Contributor guide
Assessment
This issue has not been assessed yet.