Including UWP project in WPF project raises runtime errors

0

Project I work on need to show UWP control from UWP library inside of WPF window. Here is the document page on which I had based my work (check section for adding custom UWP control): https://docs.microsoft.com/en-us/windows/communitytoolkit/controls/wpf-winforms/windowsxamlhost#add-a-custom-uwp-control

Had setup WPF window and it shows standard UWP controls (like button) at the runtime just fine. However, when I include UWP project, WPF window throws exception at start (at the moment of context initialization of EF).

Could not load file or assembly 'Windows.Foundation.UniversalApiContract, Version=7.0.0.0, Culture=neutral, PublicKeyToken=null, ContentType=WindowsRuntime' or one of its dependencies. Operation is not supported. (Exception from HRESULT: 0x80131515)

Sqlite version I'm using is 1.0.88.0 and EF is 5. But it doesn't make any sense that it clashes with these libraries?

wpf
xaml
uwp
shared-libraries
asked on Stack Overflow Aug 1, 2019 by VladacusB

2 Answers

1

Ffixed an issue on startup by updating SQLite package to 1.0.111.0 and EF to version 6.2.0.

answered on Stack Overflow Aug 2, 2019 by VladacusB
0

Including UWP project in WPF project raises runtime errors

Derive from official document, I create sample project. When build the project, it throw many errors that lost assembly. After add the Windows.winmd file every thing work well. You could try to add the Windows.winmd file where in the C:\Program Files (x86)\Windows Kits\10\UnionMetadata\Windows.winmd to WPF app reference.

Detail steps

Right click project References -> Add References -> Browse(file type all file)-> select Windows.winmd

And this sample project that you could refer this.

answered on Stack Overflow Aug 2, 2019 by Nico Zhu - MSFT

User contributions licensed under CC BY-SA 3.0