We have an in-house code C++ COM library. We are currently consuming the library from a C# application. Works fine.
However, the registration and unregistration of COM objects is tedious and is starting to be a problem for users upgrading to win7 due to the need for running the registration with admin priviledges (not possible directly from our Click-once application).
So… Since we really have no reason for using the library through COM (it’s coded as COM for historic reasons), we’d like to switch to just exposing methods as ‘plain exports’.
First attempt was just exposing the methods next to the COM Classes. Looks fine through appropriate tools for inspecting dlls.
Now, when I remove the COM reference in VS and include the dll by just ‘browsing’ in the add-reference dialog, it is still treated as a COM object and the dll is not included in output as I would expect.
Is it ‘illegal’ to use a COM library as simple dll? What is the best way through this problem?
Thanks for any input!
Anders, Denmark
You cannot use the add references dialogs to add a DLL, even if it wasn’t a COM one. Now as it is COM it recognizes it and loads it at a COM object.
The simplest solution is probably to use registration free COM, which means you can deploy the DLL with your application rather than actually having to register it, but you still talk to it as a COM object. It is just a case of manipulating your manifest file.
Try the tool at here to help you generate the manifest, or a search on here for registration free COM.