COM Extraction and Registration of DLLs go hand-in-hand in an installation project. In InstallShield, there are several ways to extract COM information and self-register DLLs. Through experience, I have come to the conclusion that there are no hard and fast rules for doing this task. Just try each method and see if it works for your case. One method generally does.
Here are five methods to accomplish this task:
- In the Setup Design view, right-click the desired feature and select Component Wizard. Browse to the file, add it and select the Extract COM Info Immediately checkbox. Then complete the Component Wizard.
- In the Setup Design view, click the component that contains the DLL and set the COM Extract at Build property to Yes.
- In the Setup Design view, click the component that contains the DLL, expand the Files node, right-click the key file and select Extract COM Data for Key file.
- In the Setup Design view, click the component, expand the Files node, right-click the key file, select Properties, then select the Self-Register checkbox. Be sure to click Apply, then OK.
- In the InstallScript view, you can do manual registration by calling regsvr32.exe. If you are doing this from an InstallScript custom action in a Basic MSI project, you may need to set the custom action to Deferred in System Context.
Let’s look at each of these methods.
In the first method, you right-click on the feature you want to add the new component to and select Component Wizard. Here is a screenshot of that:
Extract COM Info Immediately in the Component Wizard
In the second method, you set the COM Extract at Build property to Yes for the component. Here is a screenshot of that:
COM Extract at Build property
When you set this property to Yes, the COM information will be extracted each time the installation is built. This is useful if the information frequently changes. If it doesn’t, you can use one of the other methods.
In the third method, you expand the Files node for a component, right-click on the key file and select Extract COM Data for key file. Here is a screenshot of that:
Extract COM Data for key file
When you do this, it adds the COM information to the registry node for the selected component. If you update the DLL after doing this, you will probably need to delete the registry entries and extract the COM information again.
In the fourth method, you expand the Files node for a component, right-click the key file, select Properties and then select the Self-Register checkbox. Here is a screenshot of that.
Selecting Self-Register for a key file
After you select the checkbox, be sure to click Apply, then OK.
In the fifth and final method, you can register the DLL manually through InstallScript code. Here is a screenshot of that.
Registering a DLL through InstallScript code
Next time you’re faced with this issue, test each of these methods. One of them should work for you.