简体   繁体   English

如何使用 XamlIslands 和桌面桥 package 和 WPF (.NET Core) 应用程序?

[英]How to package a WPF (.NET Core) app with XamlIslands and Desktop Bridge?

I have an application in WPF targeting .NET Core v3.1 and I'm using XamlIslands to display Windows 10 UI components.我在WPF中有一个针对.NET Core v3.1的应用程序,我正在使用XamlIslands来显示 Windows 10 个 UI 组件。 In order to use XamlIslands , I had to first migrate my app from .NET Framework to .NET Core .为了使用XamlIslands ,我必须首先将我的应用程序从.NET Framework迁移到.NET Core

I put my custom UWP components into a UWP project , which targets Win10 version 2004 , min version is 1903 .我将自定义UWP组件放入UWP project中,该项目针对Win10 version 2004 ,最低版本为1903 And in the WPF project I can reference these custom UWP components using XamlHosts .WPF项目中,我可以使用XamlHosts引用这些自定义UWP组件。

Then, I have a Desktop Bridge project, which can package the WPF application, to be able to upload to the Microsoft Store.然后,我有一个Desktop Bridge项目,可以将WPF应用程序上传到Microsoft Store。

The project compiles and runs correctly, I can run even the packaging project, but when I try to create a sideloaded App Package, it gives me the following error:该项目编译并正确运行,我什至可以运行打包项目,但是当我尝试创建一个侧面加载的应用程序 Package 时,它给了我以下错误:

Project UWP is not compatible with netcoreapp3.1 (.NETCoreApp,Version=v3.1) / win-x64. Project UWP supports: uap10.0.18362 (UAP,Version=v10.0.18362)
Project UWP is not compatible with netcoreapp3.1 (.NETCoreApp,Version=v3.1). Project UWP supports: uap10.0.18362 (UAP,Version=v10.0.18362)

I tried to set the min version for the UWP app to windows 10, build 10240 (this is the oldest one), but the same error appeared (of course, with the updated uap version).我尝试将UWP应用程序的最低版本设置为windows 10, build 10240 (这是最旧的版本),但出现了相同的错误(当然,更新了 uap 版本)。

In this answer I read that maybe I should create a .NET Standard project?这个答案中,我读到也许我应该创建一个.NET Standard项目? But there is no way to create a WPF application targeting .NET Standard .但是没有办法创建针对.NET StandardWPF应用程序。

  1. How the error message says that the UWP app is not compatible with .netcore when I could build and run the whole solution?当我可以构建和运行整个解决方案时,错误消息如何说明UWP应用程序与.netcore不兼容? If it runs, why can't create an App Package?如果运行,为什么不能创建 App Package?
  2. How can I create an App Package then, which I can upload to the Store?那么我如何创建一个应用程序 Package,我可以将其上传到商店?

How to package a WPF (.NET Core) app with XamlIslands and bridge?如何使用 XamlIslands 和桥接 package 和 WPF (.NET Core) 应用程序?

Please refer Host a custom WinRT XAML control in a WPF app using XAML Islands official document.请参阅使用 XAML Islands 官方文档在 WPF 应用程序中托管自定义 WinRT XAML 控件 And derive from your information, it looks you have not configured your solution to target a specific platform such as x86 or x64.根据您的信息,您似乎尚未将解决方案配置为针对特定平台,例如 x86 或 x64。 Custom WinRT XAML controls are not supported in projects that target Any CPU.针对任何 CPU 的项目不支持自定义 WinRT XAML 控件。 And please don't forget edit your wpf project configuration请不要忘记编辑您的 wpf 项目配置

 <AssetTargetFallback>uap10.0.19041</AssetTargetFallback>

I have make a code sample and I could make the package base on above steps, here is official code sample, you could download it and test to make a package.我已经制作了一个代码示例,我可以根据上述步骤制作 package,这里是官方代码示例,您可以下载并测试制作 package。

暂无
暂无

声明:本站的技术帖子网页,遵循CC BY-SA 4.0协议,如果您需要转载,请注明本站网址或者原文地址。任何问题请咨询:yoyou2525@163.com.

相关问题 Wpf Core Desktop Bridge无法在微软商店实现应用内购买 - Unable to implement in-app purchase in the Microsoft store for Wpf Core Desktop Bridge 带有 WPF 桌面桥包的 UWP 中的 System.BadImageFormatException - System.BadImageFormatException in UWP with WPF desktop bridge package 如何对使用 XamlIslands 的 WPF 应用程序进行单元测试? - How to unit test a WPF application which uses XamlIslands? 如何检测我的库是否在.Net Core 3 Desktop Package下运行 - How to detect that my library is running under .Net Core 3 Desktop Package 桌面桥吐司打开应用程序 - Desktop bridge toast open app .net core 跨平台桌面应用 - .net core cross platform desktop app 更新 WPF 桌面桥通用应用程序时无法升级设置 - Can't upgrade settings when updating a WPF Desktop Bridge Universal app 我可以使用哪个.NET对象将文件从WPF桌面应用程序移动(流式传输)到Azure Webapp(.NET Core 2)? - Which .NET object can I use to move(stream?) a file from a WPF desktop app to an Azure webapp (.NET Core 2)? 要使用 AD B2C 对 .NET Core 3.0 WPF 桌面客户端进行身份验证,如何使用默认操作系统浏览器? - To authenticate .NET Core 3.0 WPF desktop client with AD B2C, how to use the Default OS Browser? 有没有办法自动匹配遗留应用程序和UWP包与桌面桥之间的构建版本? - Is there a way to automatically match build versions between legacy app and UWP package with Desktop Bridge?
 
粤ICP备18138465号  © 2020-2024 STACKOOM.COM