I'm trying to embed a WinUI control in a legacy C++ MFC application using Xaml Islands. I have followed the Host a custom WinRT XAML control in a C++ desktop (Win32) app as a guide. My MFC application compiles up to the moment I follow the "Host the custom WinRT XAML control in the desktop project" section of the tutorial. I get the following error when I reference IDesktopWindowXamlSourceNative
and compile my application.
// Line with C2139 error
auto interop = _desktopWindowXamlSource.as<IDesktopWindowXamlSourceNative>();
Build Error:
**\Generated Files\winrt\base.h(1981,53):error C2139:
IDesktopWindowXamlSourceNative
: an undefined class is not allowed as an argument to compiler intrinsic type trait__is_base_of
I've successfully completed the tutorial example, but when I applied the steps to our legacy MFC application it is not compiling. I'm not sure what could be the problem.