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.

Resource could not be found when adding image as asset

See original GitHub issue

I’m trying to add an image to my project as an asset. I am following the MVVM template and the Assets guide on the Quickstart page. I have my image in a folder called Assets in my project directory and have included assets in my project file.

The image is present in the folder: Assets\image.png which is in my project directory

In my .csproj file I have: <AvaloniaResource Include="Assets\*" />

In my view I have: <Image Source=:image.png" />

The error I am getting is: Could not convert object ‘imapge.png’ (of type System.String) to {clr-namespace:Avalonia.Media.Imaging;assembly=Avalonia.Visuals}IBitmap: The resource image.bmp could not be found.

Issue Analytics

  • State:closed
  • Created 4 years ago
  • Reactions:1
  • Comments:7 (3 by maintainers)

github_iconTop GitHub Comments

1reaction
colinparkscommented, Jul 18, 2019

After I changed the Build Action to Embedded Resource this worked. Thanks.

Read more comments on GitHub >

github_iconTop Results From Across the Web

Flutter web asset images not displaying when deployed to ...
In my case, the problem was I was using Image.network instead of Image.asset which did not cause an error when running locally as...
Read more >
Adding assets and images | Flutter
Adding assets and images ... Flutter apps can include both code and assets (sometimes called resources). An asset is a file that is...
Read more >
[Solved] Unable to load asset Error in Flutter
This error occurs when you have incorrectly indexed the image or image folder in pubspec.yaml file. Error Message: ══╡ EXCEPTION CAUGHT BY IMAGE...
Read more >
2 Easy Steps to Fix Unable to Load Asset in Flutter
Step 1: Make sure you have added the correct image path (without a spelling mistake). Note: To always get the correct image path...
Read more >
Load images and assets tailored for scale, theme, high ...
Your app can load image resource files containing images tailored for display scale factor, theme, high contrast, and other runtime ...
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