dotnet / dotnet/project-system
WPF .NET Core 3 (SDK styled) project: Images (.png, .jpg etc) don't get correct Build Action when added to project
- Dominant language
- C#
- Stars
- 1k
- Forks
- 415
- PR merge metrics
- No merged PRs in 30d
Description
When you have a .NET Core 3 WPF project in Visual Studio 2019 and you add a .png or a .jpg file, these files have the Build Action "None". That means if you use the image with an Image element in XAML, the Image won't be displayed at runtime, as it is not available at runtime.
The Build Action should be set to "Resource" when adding such an image. This happens, if you have a WPF project with the old .csproj format.
This problem is directly related to this issue on Github: https://github.com/dotnet/wpf/issues/292
Thanks a lot,
Thomas
_This issue has been moved from https://developercommunity.visualstudio.com/content/problem/440436/wpf-net-core-3-sdk-styled-project-images-png-jpg-e.html
VSTS ticketId: 781517_
_These are the original issue comments:_
Thomas Claudius Huber on 30/01/2019, 09:16 PM (4 days ago): Note: This happens with SDK-styled projets. It is not directly related to .NET Core 3. When you create an SDK styled project with WPF that targets .NET Framework 4.7.2, you have the same issue that images added to the project have the Build Action "None" instead of Resource.
_These are the original issue solutions:_
(no solutions)
Contributor guide
Assessment
This issue has not been assessed yet.