dotnet / maui

.NET MAUI is the .NET Multi-platform App UI, a framework for building native device applications spanning mobile, tablet, and desktop.
https://dot.net/maui
MIT License
22.05k stars 1.73k forks source link

Blazor MAUI Changing AppIcon and Splash screen seems trivial, fails to compile after making changes #7872

Closed nssidhu closed 2 years ago

nssidhu commented 2 years ago

Description

I am trying to replace the default icon and splash screen with my .png file.

It turns out, that it is not so simple as I have seen in presentation. Not sure why this basic thing is so complicated.

<ItemGroup>
        <!-- App Icon -->
        <MauiIcon Include="Resources\ic_launcher_round.png" />

        <!-- Splash Screen -->
        <MauiSplashScreen Include="Resources\ic_splash_icon.png" Color="white" />

        <!-- Images -->
        <MauiImage Include="Resources\Images\*" />

        <!-- Custom Fonts -->
        <MauiFont Include="Resources\Fonts\*" />

        <!-- Raw Assets (also remove the "Resources\Raw" prefix) -->
        <MauiAsset Include="Resources\Raw\**" LogicalName="%(RecursiveDir)%(Filename)%(Extension)" />
    </ItemGroup>

I am running into the following error (for Android) i guess i will encounter similar error for other platform as well.

image

Steps to Reproduce

In MAUI Blazor Project change the existing Icon & splash screen .svg with custom .png Try to compile after making those change and the project will fail to compile.

Version with bug

6.0 (current)

Last version that worked well

Unknown/Other

Affected platforms

Android

Affected platform versions

Android

Did you find any workaround?

No

Relevant log output

Severity    Code    Description Project File    Line    Suppression State
Error   APT2260 resource mipmap/appicon_round (aka com.companyname.XXXXXschedulingmobile:mipmap/appicon_round) not found.

This error is likely caused by an issue with the AndroidManifest.xml file or an Android manifest generation attribute in a source code file.    XXXXXXSchedulingMobile  C:\Users\admin\source\repos\BookNow-Blazor\XXXXSchedulingMobile\Platforms\Android\AndroidManifest.xml   1   

Severity    Code    Description Project File    Line    Suppression State
Error   APT2260 resource mipmap/appicon (aka com.companyname.XXXXXschedulingmobile:mipmap/appicon) not found.

This error is likely caused by an issue with the AndroidManifest.xml file or an Android manifest generation attribute in a source code file.    XXXXXSchedulingMobile   C:\Users\admin\source\repos\BookNow-Blazor\XXXXSchedulingMobile\Platforms\Android\AndroidManifest.xml   1
nssidhu commented 2 years ago

Doing the following steps helped me resolve the error.

1) Closed the Visual studio 2) using Windows file Explorer navigated to the root project and deleted bin & obj folder 3) Re-Opened the project and as a precaution did the clean solution (not sure if this is needed)

Was able to Run the project successfully it afterwards

Also I had to change the MauiIcon to the following as foreground image is needed.

I was able to change both the icon and splash screen.