Maui - publish as exe and create exe with icon

Dani_S 4,501 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,

Developer technologies | .NET | .NET MAUI
0 comments No comments
{count} votes

Accepted answer
  1. Anonymous
    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

Your answer

Answers can be marked as Accepted Answers by the question author, which helps users to know the answer solved the author's problem.