Search code examples
c#.netwpf.net-coremsix

Run sideloaded WPF Core 3.0 app from command line


I've run into a problem while publishing a WPF Core 3.0 app. I created a Windows Application Packaging Project in my solution and then published the WPF app as sideloaded. It was published correctly and I can run it without any problems. However, now I need to start the sideloaded WPF app from another application (WinForms) programmatically with line arguments. Is there any way to do that? Thanks


Solution

  • You can define an app execution alias extension for your packaged app. Please refer to the docs and this blog post for more information.

    <Package
      xmlns:uap3="http://schemas.microsoft.com/appx/manifest/uap/windows10/3"
      IgnorableNamespaces="uap3">
        <Applications>
            <Application>
                <Extensions>
                    <uap3:Extension
                    Category="windows.appExecutionAlias"
                    Executable="exes\launcher.exe"
                    EntryPoint="Windows.FullTrustApplication">
                        <uap3:AppExecutionAlias>
                            <desktop:ExecutionAlias Alias="Contoso.exe" />
                        </uap3:AppExecutionAlias>
                    </uap3:Extension>
                </Extensions>
            </Application>
        </Applications>
    </Package>