dotnet / dotnet/project-system
Consider adding more EmbeddedResource metadata to the sdk
- Dominant language
- C#
- Stars
- 1k
- Forks
- 415
- PR merge metrics
- No merged PRs in 30d
Description
Once #2873 is fixed we can potentially include more metadata into the [default glob in the SDK for `EmbeddedResource`](https://github.com/dotnet/sdk/blob/master/src/Tasks/Microsoft.NET.Build.Tasks/targets/Microsoft.NET.Sdk.DefaultItems.props#L34) to simplify the project file with respect to resource files (*.resx).
For example, consider if the SDK was expanded to the following:
```xml
ResXFileCodeGenerator
%(Filename).Designer.cs
True
True
True
True
$([System.IO.Path]::ChangeExtension($([System.IO.Path]::GetFileNameWithoutExtension(%(Identity))), '.resx'))
```
This would mean that the act of adding a `.resx` file to a project would result in no changes to the project file. Any pre-existing (standard) configuration in project files could be removed if users want to clean up their project files. Automatic or manual running of the custom tool for a `.resx` file also wouldn't modify the project.
The problem with the above is the assumption that `*.Designer.cs` is solely for `.resx` files, which doesn't hold true for Windows Forms apps, and possibly others. We could go half-way and just include the `EmbeddedResource` item above, which would result in some cleanup of the file, but not all.
We should investigate if there are ways to make the whole thing possible. One option to investigate is if we can change the filename for the generated designer files for `.resx` files to make them more uniquely identifiable, like `Resource1.resx.designer.cs`, though doing that in a backwards compatible way would present a challenge. Other possibilities should be considered.
Contributor guide
Assessment
This issue has not been assessed yet.