I start 2 projects in one solution, one is
.Net Framework 4.7.2 and the other one is
Windows Runtime Component(C++/WinRT),
What I want to do is write my DirectX related code in the
WindowsRuntimeComponent and expose a certain number of classes to the
I just add reference to the
WindowsRuntimeComponent project in the .Net project, It was a success and .Net seems to understand what is in the C++ project
However, when I try to create an instance from
it gives me an error saying...
Class not registered(Exception from HRESULT: 0x80040154 (REGDB_E_CLASSNOTREG) error screenshot
Im new to COM and basically all I know about COM is form enter link description here So how I suppose to do ?
To instantiate a class via WinRT (the class you made in C++/CX), you need to declare it in your manifest or otherwise Windows will not know which .dll file to look in (and that will result in REGDB_E_CLASSNOTREG HRESULT/ClassNotRegistered exception).
Up until recently, this was only available to UWP applications and they had to declare these dependencies in their AppXManifest.xml file. However, recent Windows versions support declaring these dependencies in Win32 manifest. This is how you do it:
<?xml version="1.0" encoding="utf-8"?> <assembly manifestVersion="1.0" xmlns="urn:schemas-microsoft-com:asm.v1"> <assemblyIdentity version="126.96.36.199" name="MyApplication.app"/> <file name="RuntimeComponent1.dll"> <activatableClass name="RuntimeComponent1.Class" threadingModel="both" xmlns="urn:schemas-microsoft-com:winrt.v1" /> </file> </assembly>
You can read more about it here:
User contributions licensed under CC BY-SA 3.0