question-mark
Stuck on an issue?

Lightrun Answers was designed to reduce the constant googling that comes with debugging 3rd party libraries. It collects links to all the places you might be looking at while hunting down a tough bug.

And, if you’re still stuck at the end, we’re happy to hop on a call to see how we can help out.

jpg or jpeg images added to winui3 projects do not get the content build action by default.

See original GitHub issue

Describe the bug

The jpg format images are not showing when using Image control or when using them as background brushes. This is a critical bug and should be fixed at the earliest. It is a very basic thing which devs would expect to work.

Steps to reproduce the bug

  1. Create a new WinUI 3 in Desktop app.
  2. Add below xaml inside Stackpanel in MainWindow.xaml <Image Source="/Assets/treetops.jpg" Height="100" />
  3. Add treetops.jpg image (from xaml controls gallery sample app) in assets folder.
  4. Run the app.

Expected behavior

jpg images should be visible correctly.

Screenshots

WinUi jpg bug WinUi jpg bug code

NuGet package version

WinUI 3 - Windows App SDK 1.0 (If you’re seeing your issue in older previews of WinUI 3, please try this release)

Windows app type

  • UWP
  • Win32

Device form factor

Desktop

Windows version

May 2021 Update (19043)

Additional context

No response

Issue Analytics

  • State:open
  • Created 2 years ago
  • Comments:6 (2 by maintainers)

github_iconTop GitHub Comments

1reaction
castorixcommented, Dec 5, 2021

There is no bug You must add pictures to the project, or they won’t be compiled WinUI 3 is in good shape…

0reactions
eFailcommented, Jun 23, 2023

I wasted several hours trying to understand why <SvgImageSource/> doesn’t work. No matter what I did, my SVG image would not show up. Turned out it was because of this bug. This is a significant deviation from past behavior and should eventually be fixed. Setting BuildAction=Content fixed my issue instantly.

Read more comments on GitHub >

github_iconTop Results From Across the Web

Build actions for files - Visual Studio (Windows)
All files in a Visual Studio project have a build action. The build action controls what happens to the file when the project...
Read more >
WPF .NET Core 3 (SDK styled) project: Images (.png, .jpg ...
When you have a .NET Core 3 WPF project in Visual Studio 2019 and you add a .png or a .jpg file, these...
Read more >
Assets and image display
Add the image file to the Assets directory of a shared project. Set the build action to Content . Using the asset is...
Read more >
WPF - Image 'is not part of the project or its Build Action is ...
In Windows Explorer copy the Image into your project resource folder. · From within Visual Studio right click on the Resources and select...
Read more >
[Solved] How to load image files (added to the project) into ...
The image files won't get "Copy" build action in the project, so the build won't copy them in the output directory; the files...
Read more >

github_iconTop Related Medium Post

No results found

github_iconTop Related StackOverflow Question

No results found

github_iconTroubleshoot Live Code

Lightrun enables developers to add logs, metrics and snapshots to live code - no restarts or redeploys required.
Start Free

github_iconTop Related Reddit Thread

No results found

github_iconTop Related Hackernoon Post

No results found

github_iconTop Related Tweet

No results found

github_iconTop Related Dev.to Post

No results found

github_iconTop Related Hashnode Post

No results found