Search code examples
publishmauiwinui-3msixappinstaller

Visual Studio publish sideloading MSIX appinstaller for WPF, WinUI3, MAUI


I have a problem to create a sideloading appinstaller with automatic updates for MAUI project. It seems it is not working.

I found a way to create an appinstaller for WPF .NET, WinUI3 and bugged MAUI and described it as answer.


Solution

  • I found that there are little differences how to create an appinstaller for WPF, WinUi3 and MAUI. There is a short summary:

    • WPF .NET (core) - works well - There is great tutorial MSIX Installer for Desktop Applications - Packaging WPF, WinForms, and UWP Applications that is usefull for all projects.
    • WinUi 3 in Desktop - work well - RMB on the project > Package and Publish > Create App Packages...
    • Template Studio for WinUi - work well - RMB on the project > Package and Publish > Create App Packages...
    • MAUI - the Visual Assets and appinstaller is bugged - RMB on the project > Publish...

    If this is your first time that you create an installer it is a good idea to start from one of working project types like WPF, WinUi3 rather than MAUI. Then you can use generated files to use in bugged MAUI project.

    WPF .NET (core)

    There is great tutorial MSIX Installer for Desktop Applications - Packaging WPF, WinForms, and UWP Applications.

    To add a WPF .NET project template you need to install .NET Framework 3.5 by Visual Studio Installer Install .NET Framework 3.5 by Visual Studio Installer Then follow the tutorial. The steps are similar to next project.

    Blank App, Packaged (WinUI 3 in Desktop)

    Blank App, Packaged (WinUI 3 in Desktop)

    The Package.appxmanifest is in project main folder

    BlankApp Package.appxmanifest

    Can by published by Package and Publish > Create App Packages... BlankApp Create App Packages

    Template Studio for WinUI

    Look at the Blank App, Packaged (WinUI 3 in Desktop)

    MAUI

    The Package.appxmanifest is in Platforms > Windows > Package.appxmanifest

    MAUI Package.appxmanifest

    But the Visual Assets generator is broken. You need to:

    • Select source image
    • Set destination to e.g. Resources\AppIcon
    • Rename all images names e.g. Small Tile > AppIcon$placeholder$.png (It's much to do so read a tip a few lines below)
    • Point every image to it's file

    It is good idea to create WinUI3 project e.g. Blank App, Packaged or Template Studio for WinUi to configure the Package.appmanifest (Visual Assets works well) and then copy it with Resources\AppIcon to MAUI project.

    MAUI broken Visual Assets

    Can be published by Publish...

    MAUI Publish

    The MAUI publisher is broken and do not generate:

    • index.html
    • Installer.appinstaller

    MAUI broken publisher

    The .html and .appinstaller can be copied from WPF .NET or WinUI3 project and manually edited. If you have problems with appinstaller you can use an example below

    App1_Installer.appinstaller

        <?xml version="1.0" encoding="utf-8"?>
        <AppInstaller
            xmlns="http://schemas.microsoft.com/appx/appinstaller/2017/2"
            Version="0.0.10.0"
            Uri="file:///C:/IIS/apps/App1/App1_Installer.appinstaller" >
    
            <MainPackage
                Name="package unique name"
                Publisher="CN=company"
                Version="0.0.10.0"
                ProcessorArchitecture="x86"
                Uri="file:///C:/IIS/apps/App1/App1_0.0.10.0_Debug_Test/App1_0.0.10.0_x86_Debug.msix" />
    
            <UpdateSettings>
                <OnLaunch 
                    HoursBetweenUpdateChecks="0" />
                <AutomaticBackgroundTask />
            </UpdateSettings>
        </AppInstaller>