如何从WinForms应用程序打开MAUI应用程序

huangapple go评论82阅读模式
英文:

How to open MAUI Application from WinForms Application

问题

我正在开发一个 WinForms 应用程序,尝试从 WinForms 应用程序中打开 MAUI 应用程序。

因此,我想知道是否可以在 WinForms 应用程序内部以编程方式打开 MAUI 应用程序?

谢谢您的回答。

英文:

I am working on WinForms app which I'm trying to open MAUI application from WinForms application.

So, I'm wondering if it's possible to programmatically open a MAUI application from within a WinForms app?

Thank you for the answers.

答案1

得分: 1

在Windows上,Maui项目将由MSIX Application Packager打包。您可以在**/Platforms/Windows/Package.appxmanifest**文件中的</uap:VisualElements>下面添加以下代码:

xmlns:uap5="http://schemas.microsoft.com/appx/manifest/uap/windows10/5"
     ......
     ....
</uap:VisualElements>
       <Extensions>
                    <uap5:Extension
                                Category="windows.appExecutionAlias"
                                Executable="MauiAppTest.exe"
                                EntryPoint="Windows.FullTrustApplication">
                          <uap5:AppExecutionAlias>
                                <uap5:ExecutionAlias Alias="MyApp.exe" />
                          </uap5:AppExecutionAlias>
                    </uap5:Extension>
              </Extensions>

然后,您可以使用Process.Start("MyApp.exe");来启动WinForms应用程序中的Maui应用。

英文:

The maui proejct on the windows will be packaged by the MSIX Application Packager. You can add the following code below </uap:VisualElements> in the /Platforms/Windows/Package.appxmanifest:

xmlns:uap5="http://schemas.microsoft.com/appx/manifest/uap/windows10/5"
     .....
     .....
</uap:VisualElements>
       <Extensions>
                    <uap5:Extension
                                Category="windows.appExecutionAlias"
                                Executable="MauiAppTest.exe"
                                EntryPoint="Windows.FullTrustApplication">
                          <uap5:AppExecutionAlias>
                                <uap5:ExecutionAlias Alias="MyApp.exe" />
                          </uap5:AppExecutionAlias>
                    </uap5:Extension>
              </Extensions>

And then, you can use the Process.Start("MyApp.exe"); to start the maui app in the WinForms Application.

huangapple
  • 本文由 发表于 2023年6月22日 20:42:20
  • 转载请务必保留本文链接:https://go.coder-hub.com/76532042.html
匿名

发表评论

匿名网友

:?: :razz: :sad: :evil: :!: :smile: :oops: :grin: :eek: :shock: :???: :cool: :lol: :mad: :twisted: :roll: :wink: :idea: :arrow: :neutral: :cry: :mrgreen:

确定