CsWinRT
CsWinRT copied to clipboard
Merge multiple CsWinRT components together to reduce package size
I am migrating a MFC C++ app to C#. I need to migrate several C++ components. I follow https://github.com/MichalStrehovsky/CppPublishAotReference to enable AOT.
It works well for the first component.
If I do same thing for the 2nd component, there will be two component dlls. Both of them contains the DotNet runtime code.
How can I merge the components into one dll, so that they can share the runtime code and reduce the package size?
I've tried solutions:
- Make project A and project B both CsWinRT component, and then let A reference B. It is Failed to build.
- Make project A CsWinRT component, and let A reference B. project A can be built, but the types in project B are not exported.
- Make CsWinRT component C, and let C reference A and B. In C, create proxy types for all public types in A and B. It can work, but requires many additional code.