[英]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 Standard
的WPF
应用程序。
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?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.