Closed ghost closed 2 years ago
Hello TamBuiWork, thank you for opening an issue with us!
I have automatically added a "needs triage" label to help get things started. Our team will analyze and investigate the issue, and escalate it to the relevant team if possible. Other community members may also look into the issue and provide feedback 🙌
It works well if you add reference to XamlIslandsTest.UwpPart in WAP project.
Tested on Windows 11 22000.434, VS 2019 16.9.8
@michalleptuch Thank you for your help validating. However, when I try to add a reference to XamlIslandsTest.UwpPart as you described, the WAP project fails to build for me with this error:
AppxManifest.xml : error APPX0501: Validation error. error 80080204: App manifest validation error: Line 48, Column 27, Reason: The field "[local-name()='Extensions']/[local-name()='Extension']/[local-name()='InProcessServer']/[local-name()='ActivatableClass']" with value "Microsoft.Toolkit.Win32.UI.XamlHost.XamlApplication" must only be declared once. A duplicate exists on Line 42, Column 27.
Navigating to the error in AppManifest.xml shows the following snippet where the duplicate entry can be seen:
<Extensions>
<Extension Category="windows.activatableClass.inProcessServer">
<InProcessServer>
<Path>Microsoft.Toolkit.Win32.UI.XamlHost.dll</Path>
<ActivatableClass ActivatableClassId="Microsoft.Toolkit.Win32.UI.XamlHost.XamlApplication" ThreadingModel="both" />
</InProcessServer>
</Extension>
<Extension Category="windows.activatableClass.inProcessServer">
<InProcessServer>
<Path>XamlIslandsTest.DesktopApp\Microsoft.Toolkit.Win32.UI.XamlHost.dll</Path>
<ActivatableClass ActivatableClassId="Microsoft.Toolkit.Win32.UI.XamlHost.XamlApplication" ThreadingModel="both" />
</InProcessServer>
</Extension>
</Extensions>
When I try to manually remove either duplicate entry, it always comes back after I build.
Did you encounter any similar error? And if so, how did you overcome this error?
It's known issue: https://github.com/CommunityToolkit/Microsoft.Toolkit.Win32/issues/328 You need to use older version of Visual Studio 2019
@michalleptuch Thank you! I wasn't aware of that, this confirms my initial suspicion then. I appreciate your prompt response.
This issue has been marked as "needs attention 👋" due to no activity for 15 days. Please triage the issue so the fix can be established.
This issue has been marked as "needs attention 👋" due to no activity for 15 days. Please triage the issue so the fix can be established.
This issue has been marked as "needs attention 👋" due to no activity for 15 days. Please triage the issue so the fix can be established.
Using the information from the bug ticket that @michalleptuch provided, I did the following and got it to work:
</project>
: <Target Name="_RemoveWinMDFromAppxManifest" BeforeTargets="_GenerateCurrentProjectAppxManifest">
<ItemGroup>
<_AppxWinmdFilesToHarvest Remove="@(_AppxWinmdFilesToHarvest)" />
</ItemGroup>
</Target>
<Target Name="_StompSourceProjectForWapProject" BeforeTargets="_ConvertItems">
<ItemGroup>
<_TemporaryFilteredWapProjOutput Include="@(_FilteredNonWapProjProjectOutput)" />
<_FilteredNonWapProjProjectOutput Remove="@(_TemporaryFilteredWapProjOutput)" />
<_FilteredNonWapProjProjectOutput Include="@(_TemporaryFilteredWapProjOutput)">
<SourceProject>
</SourceProject>
</_FilteredNonWapProjProjectOutput>
<_DetailedPriXml Remove="@(_DetailedPriXml)" />
</ItemGroup>
</Target>
Once I did the above two, I got the app to launch from the WAP project.
That's great but did you try to create Release package for MS Store?
@michalleptuch I did not try that, because for my purposes, my app does not need to be released for MS Store.
Describe the bug
The issue is I have a simple minimal example project that showcases a WPF app utilizing a UWP control, using XAML islands. It works. This is what it looks like when I run it:
And it still works when I run directly from the WPF project (F5 - Start Debug). However, if I try to package this WPF project now inside a WAP project, and run it from the WAP project, it shows this error:
The strange thing is that this used to work fine just a few months ago with the same code. The only things that could have changed in the past few months was my Visual Studio version, or my OS version may have upgraded to 20H2 (19042).
Steps to Reproduce
Steps to reproduce the behavior:
Expected behavior
I expect the app packaged project to run the XAML Islands app, just as the XAML Islands app is able to run as a standalone WPF app.
Environment