Replies: 1 comment 2 replies
-
You can modify your project file (.csproj) to make it copy the xaml and xbf files you need to the output directory. |
Beta Was this translation helpful? Give feedback.
2 replies
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment
-
If I create a WinUI 3 C++ runtime component containing a class with Xaml (e.g a UserControl), then try to use it from a WinUI 3 c# app, via a WinUI 3 projection class library, I'm finding that the app fails on startup. The problem seems to be that the app is looking for the .xaml and .xbf files associated with the user control, but although these files appear below the projection class library directory, they're missing from the app directory. Do I have to add something extra to the project files to copy the xaml files to the correct place? The runtime component comes with a stub class (Class.cpp). I can use that class from the app no problem.
Following as much as possible the CsWinRT walkthrough, I've created a solution (XProjectionSample.sln) containing a runtime component project called XComponent (XComponent.vcxproj), to which I've added a user control called XUserCtrl. The same solution contains a WinUI 3 projection class library project (XProjection.csproj). I've also created a C# app (XProjectionApp) to use XComponent via a nuget package. Both XProjectionSample and XprojectionApp are in their own separate directories under a parent directory, XProjectionTest. Everything is built for debug, and I'm using Visual Studio 2022 Community 17.9.6.
What I'm finding is that the app fails on startup, but if I manually copy the XProjectionSample\ _build\AnyCPU\Debug\XProjection\bin\XComponent folder to the XProjectionApp\bin\x64\Debug\net6.0-windows10.0.19041.0\win10-x64\AppX folder, it works.
The projects can be downloaded from: https://1drv.ms/u/s!ArdAaIuUWNACgow5iOoTIk1EqR0M3w?e=jBEJJZ.
If there's any advice you could give on what the issue might be, it would be much appreciated.
Beta Was this translation helpful? Give feedback.
All reactions