CsWinRT icon indicating copy to clipboard operation
CsWinRT copied to clipboard

manifest-free activation difficult for C# WinRT components

Open tecnoprogram-thomas opened this issue 1 year ago • 4 comments

I created a C# WinRT component (say CustomClassLibrary.dll) and I want to activate it with manifest-free activation from cppwinrt.

The problem is that C# component don't have the DllGetActivationFactory inside the assembly DLL, so the winrt manifest-free activator tryes to load the dll but fails in finding the GetProcAddress of DllGetActivationFactory . The DllGetActivationFactory in C# is actually implemented/exported by the WinRT.Host.dll, which the user can eventually rename to something like CustomClassLibrary.Host.dll I suggest that the cppwinrt activator could try to load an additional DLL with a conventional suffix (.Host.dll ?) to support this scenario, or if not fixed to give an option to customize the actually loaded DLL name.

The workaround at the moment is to implement the winrt_activation_handler detour and custom implement the library loading.

tecnoprogram-thomas avatar Dec 02 '22 13:12 tecnoprogram-thomas