Search code examples
installationsetup-projectregistrationocxlicense-key

Pass parameters for ocx registration during installation in VS setup project


I have an OCX that requires licensing in order for it to work. The vendor tells me to register it this way:

regsvr32.exe "widget.ocx" "/i:licensekey" /s

I am using Visual Studio 2008 Setup Project where the OCX is detected as a dependency. I have the Register property set to "vsdrfCOMSelfReg". However, I don't see a way of passing the /s and /i parameters. This causes the OCX registration process to display a registration dialog to the user, which I don't want.

Any idea how I can pass the license key during OCX installation in VS Setup Project?


Solution

  • Since the file is registered in a special way, "vsdrfCOMSelfReg" won't work. Instead, you can try using a custom action which runs the registration command.

    Basically, you can write custom code which launches regsvr32.exe with the appropriate command line. For example, you can use ShellExecute.