I have some structs and enums in IDL file inside c++/winrt WRC project.
This is so the data structures can be shared between C++ and C#.
Add Winmd to UWP C# project and types are visible ok
Then on trying winrt projects
Winrt CoreApp Project builds fine after adding the winmd but never sees the types.
Winrt Blank Project fails to compile in some xaml related files due to my types , simply as result of adding winmd.
But no such issues with C# UWP project. In C# uwp i can see my type and use it no issues.
cheers
So if C# can consume the types implemented in the WinRT component, it sounds like you may not have included a header file. Did you include the header file for the Windows Rutime Component in your
pch.h
file?Let's say you have an windows runtime projected type called
Cat
that's in a Windows Runtime Component calledMyComponent
, if the name of your .winmd file is "MyComponent.winmd", do the following:In your consuming project (your .exe, for example), add a reference to the .winmd file.
Build the project (must do this!)
Include a header for it in your
pch.h
file:#include "winrt/MyComponent.h" <-- don't forget!
Once that's done, you should be able to find Cat (don't forget the namespace scope resolution, etc.)