Open mentorfloat opened 4 years ago
Thanks for reporting this issue. I'll investigate the problem, and will reply back to this thread when I know more.
Have you had a chance to review that particular step in the docs? Note that the WPF sample provided here works: https://github.com/microsoft/Xaml-Islands-Samples, so something must be different.
The sample uses MSIX (last step in the tutorial) which is why it works. The tutorial will also work if the last step is followed and packaging is used.
However, according to the tutorial, MSIX is not required for WinUI to work.
I have tried multiple 2.5 and 2.4 pre-releases of WinUI including the one in the sample without any success when not using MSIX.
I too am hoping for a resolution on this as I'd like to avoid MSIX for my current use case if possible.
I'm experiencing the same issue, despite using MSIX packaging project.
Solution configuration: Debug Platform: x64
Part of debug output:
Exception thrown at 0x00007FFD3A0BD759 (KernelBase.dll) in Contoso.Dashboard.exe: WinRT originate error - 0x80004005 : 'Cannot find a Resource with the Name/Key TabViewButtonBackground'.
onecore\com\combase\winrt\error\restrictederror.cpp(1016)\combase.dll!00007FFD3BCBC8D3: (caller: 00007FFD3BCC65A9) ReturnHr(3) tid(507c) 8007007E The specified module could not be found.
Exception thrown at 0x00007FFD3A0BD759 (KernelBase.dll) in Contoso.Dashboard.exe: WinRT originate error - 0x802B000A : 'Cannot find a Resource with the Name/Key TabViewButtonBackground [Line: 2578 Position: 35]'.
onecore\com\combase\winrt\error\restrictederror.cpp(1016)\combase.dll!00007FFD3BCBC8D3: (caller: 00007FFD3BCC65A9) ReturnHr(4) tid(507c) 8007007E The specified module could not be found.
Exception thrown at 0x00007FFD3A0BD759 (KernelBase.dll) in Contoso.Dashboard.exe: WinRT originate error - 0x802B000A : 'Cannot find a Resource with the Name/Key TabViewButtonBackground [Line: 18 Position: 14]'.
onecore\com\combase\winrt\error\restrictederror.cpp(1016)\combase.dll!00007FFD3BCBC8D3: (caller: 00007FFD3BCC65A9) ReturnHr(5) tid(507c) 8007007E The specified module could not be found.
Exception thrown: 'Windows.UI.Xaml.Markup.XamlParseException' in Contoso.UWP.Controls.dll
An exception of type 'Windows.UI.Xaml.Markup.XamlParseException' occurred in Contoso.UWP.Controls.dll but was not handled in user code
The text associated with this error code could not be found.
Cannot find a Resource with the Name/Key TabViewButtonBackground [Line: 18 Position: 14]
The program '[31156] Contoso.Dashboard.exe' has exited with code 0 (0x0).
dotnet list package output: WPF Project:
[netcoreapp3.1]:
Top-level Package Requested Resolved
> Microsoft.Extensions.Configuration.Json 3.1.14 3.1.14
> Microsoft.Extensions.DependencyInjection 5.0.1 5.0.1
> Microsoft.Extensions.Options 5.0.0 5.0.0
> Microsoft.Toolkit.Mvvm 7.0.1 7.0.1
> Microsoft.Toolkit.Wpf.UI.Controls 6.1.2 6.1.2
> Microsoft.VCRTForwarders.140 1.0.6 1.0.7
UWP Application:
error: The imported project "C:\Program Files\dotnet\sdk\5.0.201\Microsoft\WindowsXaml\v16.0\Microsoft.Windows.UI.Xaml.CSharp.targets" was not found. Confirm that the expression in the Import declaration "C:\Program Files\dotnet\sdk\5.0.201\Microsoft\WindowsXaml\v16.0\Microsoft.Windows.UI.Xaml.CSharp.targets" is correct, and that the file exists on disk.
UWP Class Library (where user controls are):
error: The imported project "C:\Program Files\dotnet\sdk\5.0.201\Microsoft\WindowsXaml\v16.0\Microsoft.Windows.UI.Xaml.CSharp.targets" was not found. Confirm that the expression in the Import declaration "C:\Program Files\dotnet\sdk\5.0.201\Microsoft\WindowsXaml\v16.0\Microsoft.Windows.UI.Xaml.CSharp.targets" is correct, and that the file exists on disk.
Both UWP projects have Target Version
and Min Version
set to Version 2004 Build 19041
.
Platform, Operating System, and Programming Language OS: Windows 10 Build 19041.867 Hardware - x64 Programming language: C# Visual Studio Community 2019 16.9.3
I can send repro solution if needed.
I've managed to get some minimal example working with the newest version available at the moment.
Both with C++ and C# WinForms/WPF but without packaging. So I've used Microsoft.UI.Xaml prerelease version (2.6.0-prerelease.210623001). From what I see it's exactly the same as 2.6.0, the only difference is version number.
Packaged version for some reason doesn't work with the same error "Cannot find a Resource with the Name/Key TabViewButtonBackground". So I guess it's not packaged properly and unable find required resources/libraries.
I've tried to add dependencies to UWPApp project (that contains WinUI controls) in application manifest but without any luck so far.
It has it's own set of problems: flyout menus often have shadow on top of them, nested items in NavigationView are not displayed correctly. But that is a problem with Xaml Island itself and out of this scope. I saw already existing issues regarding that problems so hopefully that will be resolved in the next version.
Feel free to check out my repository. Hope that will help somebody. https://github.com/pziezio/WinUI2XamlIslandSamples
Describe the bug Unable to host custom controls from the WinUi library from Microsoft.UI.Xaml via Xaml Island.
Following the docs and stopping just before adding a WinUi control will work. (UWP TextBlock and Rectangle rendered fine via Xaml Island, but not after adding RatingControl.)
To Reproduce Follow the docs here: host-custom-control-with-xaml-islands until completed the step: add-a-control-from-the-winui-library-to-the-custom-control.
Building and debugging via VS will break silently without any error code. Nothing is rendered.
Expected behavior WPF project to build with WinUi control rendered.
Versions Microsoft.Toolkit.Win32.UI.XamlApplication 6.1.1 Microsoft.Toolkit.Wpf.UI.XamlHost 6.1.1 Microsoft.UI.Xaml 2.5.0-prerelease.200609001 Microsoft.VCRTForwarders.140 1.0.6 Microsoft.NETCore.UniversalWindowsPlatform 6.2.10
Platform, Operating System, and Programming Language
OS: Windows 10 Build 18363 Hardware - x64 Programming language: C#
Document Details
⚠ Do not edit this section. It is required for docs.microsoft.com ➟ GitHub issue linking.