-
Notifications
You must be signed in to change notification settings - Fork 803
Description
Description:
I'm encountering significant challenges when integrating a C++/WinRT Runtime Component into my C# WinUI 3 project, which is targeting .NET 9. It appears that .NET 9 does not support referencing Windows Metadata (.winmd) files directly, leading to errors during compilation. Additionally, using a C++/CLI wrapper to bridge the gap is problematic due to incompatibilities between C++/WinRT and /clr modes. I've attached a screenshot of the error message ("The method or operation is not implemented") encountered when creating a new C++/WinRT Runtime Component project.
Steps to Reproduce:
- Create a new C++/WinRT Runtime Component project using the WinUI 3 template in Visual Studio.
- Attempt to reference the generated .winmd file from a C# WinUI 3 project targeting .NET 9.
- Encounter the error:
MyNewProject.winmd cannot be referenced. Referencing a Windows Metadata component directly when targeting .NET 5 or higher is not supported. For more information, see https://aka.ms/netsdk1130
- Remove App.xaml/App.xaml.cpp from the C++/WinRT project and try referencing it, but the issue persists.
- Attempt to create a C++/CLI wrapper to bridge to the C++/WinRT code, but this fails due to the incompatibility of C++/WinRT code with the /clr environment required by C++/CLI.
- When creating a new C++/WinRT Runtime Component project, a separate error appears ("The method or operation is not implemented"). See attached screenshot.
Expected Behavior:
- A clear integration path where the C++/WinRT Runtime Component can be consumed by a C# WinUI 3 project targeting .NET 9 without running into the WinMD reference limitation.
Steps I've Already Tried:
- Verified that all required Visual Studio workloads and components are installed and up to date.
- Attempted using multiple project templates (both Runtime Component and Blank App templates).
- Explored creating a C++/CLI wrapper, which ultimately failed due to the incompatibility between /clr and C++/WinRT code.
Any assistance or insights into a viable integration strategy would be greatly appreciated. Thank you for your work on WinUI 3 and the Windows App SDK!
