Maui - publish as exe and create exe with icon

דני שטרית 2,686 Reputation points
2023-04-02T12:44:37.69+00:00

Hi,

I publish my MAUI app as follow and create executable file

dotnet publish -f net6.0-windows10.0.19041.0 -c Release -p:WindowsPackageType=None -p:WindowsAppSDKSelfContained=true /p:PackageCertificateThumbprint="c01ba45666762f3615cf6813aeb4dc4b1919541d"

How can create the executable with icon programmatically ?

Thanks,

.NET MAUI
.NET MAUI
A Microsoft open-source framework for building native device applications spanning mobile, tablet, and desktop.
2,837 questions
0 comments No comments
{count} votes

Accepted answer
  1. Leon Lu (Shanghai Wicresoft Co,.Ltd.) 67,781 Reputation points Microsoft Vendor
    2023-04-03T01:35:12.7233333+00:00

    Hello,

    We cannot add the icon in command line.

    However, before running dotnet publish command line, you can put icon in the Resources\AppIcon\ folder,then double click your project name in VS, open the yourproject.csproj file, you can find the MauiIcon and change the icon path.

    
            <!-- App Icon, my test icon name is icon1.png-->
            <MauiIcon Include="Resources\AppIcon\icon1.png" />
    
    

    Here is detailed document about:Change MAUI the icon

    Best Regards,

    Leon Lu


    If the answer is the right solution, please click "Accept Answer" and kindly upvote it. If you have extra questions about this answer, please click "Comment".

    Note: Please follow the steps in our documentation to enable e-mail notifications if you want to receive the related email notification for this thread.


0 additional answers

Sort by: Most helpful