Search code examples
c#wpfuwpdesktop-bridgexaml-islands

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. In order to use XamlIslands, I had to first migrate my app from .NET Framework to .NET Core.

I put my custom UWP components into a UWP project, which targets Win10 version 2004, min version is 1903. And in the WPF project I can reference these custom UWP components using XamlHosts.

Then, I have a Desktop Bridge project, which can package the WPF application, to be able to upload to the 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:

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).

In this answer I read that maybe I should create a .NET Standard project? But there is no way to create a WPF application targeting .NET Standard.

  1. How the error message says that the UWP app is not compatible with .netcore when I could build and run the whole solution? If it runs, why can't create an App Package?
  2. How can I create an App Package then, which I can upload to the Store?

Solution

  • How to package a WPF (.NET Core) app with XamlIslands and bridge?

    Please refer Host a custom WinRT XAML control in a WPF app using XAML Islands official document. And derive from your information, it looks you have not configured your solution to target a specific platform such as x86 or x64. Custom WinRT XAML controls are not supported in projects that target Any CPU. And please don't forget edit your wpf project configuration

     <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.