Every time when I create new Avalonia project and starting it, I have exception in MainWindow.axaml
:
System.IO.FileNotFoundException: "The resource /Assets/avalonia-logo.ico could not be found."
in Main Window attribute:
<Window ...
Icon="/Assets/avalonia-logo.ico" >
</Window>
But I have avalonia-logo.ico
in Assets folder.
Visual Studio 2022. I tried Avalonia version 11.0.1 or higher, different project types
The problem is that your assets' folder doesn't include in your project
to solve this, add the following lines in your csproj
file
<ItemGroup>
<AvaloniaResource Include="Assets\**" />
</ItemGroup>
OR you can include just the logo by right click on it and chose Properties
then in the Build Action
choose AvaloniaResource
as shown in the photos down.