Hi!
I made a Windows Runtime Component which I want to use in a WPF application. I created the WinRT component using C++/WinRT, and I am able to use it from a C# UWP application (it loads and I can call methods).
Now I try to add it as a reference to a NetCore 3.1 WPF project, but as soon as I try to create an instance of the component (it has a constructor), I get the following error:
System.Runtime.InteropServices.COMException: 'Error in the DLL (0x800401F9 (CO_E_ERRORINDLL))'
I added a manifest with the following section:
<file name="RuntimeComponent2.winmd" xmlns:winrt="urn:schemas-microsoft-com:winrt.v1">
<winrt:activatableClass name="RuntimeComponent2.Class1" threadingModel="both" />
</file>
I also tried creating a runtime component in C#, which does work (using the section above), but I need it to be a C++/WinRT component.
My guess is it has something to do with the VC Redistributables, I also followed the steps in Enhancing Non-packaged Desktop Apps using Windows Runtime Components and I added the Microsoft.VCRTForwarders.140 package.
Do you have any suggestions?
Kind regards,
Maarten van Sambeek