I have been pleasantly surprised that according to WPF Visual Plugins (.NET 5+) Hydra allows to build .NET core / 5+ plugins.
However the last entry indicates that I need to run regsvr32 .\PluginSample_WinForms.comhost.dll in order to register the plugin.
My application relies on xcopy deployment and doesn’t need escalated privileges. Is it possible to register the plugin at runtime in a non elevated context?
Thank you.
I wanted to try the approach outlined on stackoverflow, but I have failed in getting a simple example (Delphi Host, NET 6 WPF plugin) to run (even as admin).
Could you please provide me with an example for this ( I could not find any project that targets this scenario in the examples folder)?
This approach is not officially supported. So there is no samples for it.
This approach works for COM-based .NET Framework plugins.
However if fails for new .NET COM components (apparently its registration code does more than just writing registry issues).
Seems the only solution would be to override registry path and then run the component registration procedure (again, it is NOT officially supported):
// not a real code !!!
LoadLibrary("Oleaut32.dll")
GetProcAddress("OaEnablePerUserTLibRegistration")
Marshal.GetDelegateForFunctionPointer()
Call OaEnablePerUserTLibRegistration()
key = RegOpenKey(RegistryHive.CurrentUser, @"Software\Classes")
RegOverridePredefKey(RegistryHive.ClassesRoot, key)
RegCloseKey(key)
LoadLibrary("YourLibrary.comhost.dll")
GetProcAddress("DllRegisterServer")
Marshal.GetDelegateForFunctionPointer()
Call DllRegisterServer()
FreeLibrary()
RegOverridePredefKey(RegistryHive.ClassesRoot, null)
FreeLibrary()
This approach does not require any hacks, prior external registration or elevated privileges, all configuration is done in a custom manifest.
If you think this is something that could provide value to other users of hydra, I can upload a working sample project (Delphi host, NET 6 wpf plugin)
My apologies, I have been incapacitated for a bit. You will find a working example here: Storage Share
I managed to get it running using the approach above in x86, but did not manage in x64