I have a C++ console application to which I want to a Windows Form. I don’t want to use MFC because I don’t know how. Instead, I am using a C# to create the COM dll (Class Library). When I distribute the application and the dll to the target computer, I need to register the dll such that the application can see the COM interface and use the class I created in the dll.
I know there are a few methods to do this:
Have my application’s installer use regasm – I don’t want to use this because of two things: A. I don’t know its location on the target PC (and even if it exists somewhere, I will like not to hard-code the path to it) and B. I could redistribute regasm with the installer but I’m not sure if Microsoft allows this freely.
Have my application’s installer use gacutil – same as above.
Use regasm on the development computer to create a .reg file and then have the application’s installer execute the .reg file – there are two issues with this: A. I cannot unregister the dll in the event of an uninstallation and B. executing .reg calls the regedit which asks the user if he/she is sure if he/she wants to add the information to the registry – I would like this to be a silent “yes” and not let the user decide. regedit doesn’t have /silent argument so I gave up on using this.
Use Inno Setup installer and register the .tlb file (regtypelib flag) of the COM library – tried and the registration works but the application still cannot create an instance of the class.
Use ClickOnce to deploy the application – this is not an option because I would like my application to reside in a certain folder on the disk, not under the user’s Documents and Settings folder. To be mentioned that I’m using Express editions for the C++ and C# Visual Studio 9.0. Are there any other ways to register a COM library on a Windows XP computer.