Recently I was creating an installer that need to install a trusted root certificate. I looked at InstallShield 2010 and the only certificate support I could find was for creating IIS websites and assigning server certificates. ( As an aside, I never quite understood the usefulness of that outside of a controlled corporate environment where you are setting up many servers to belong to the same farm or to an application where you will register a hostname in DNS and all customers know the server by the same name. Also let's not mention distributing private keys in MSI's along with the passphrases needed to deploy them. Really?? )
So I looked at WiX's documentation and found the Certificate Element in the IIS Extension. Sure enough it has much broader support and can easily get the job. So I decide to create a WiX Merge Module with a snippet of code similar to:
<?xml version="1.0" encoding="UTF-8"?> <?define SourceDir="."?> <Wix xmlns="http://schemas.microsoft.com/wix/2006/wi" xmlns:iis="http://schemas.microsoft.com/wix/IIsExtension"> <Module Id="InstallCertificate" Language="1033" Version="18.104.22.168"> <Package Id="00000000-0000-0000-0000-000000000000" Manufacturer="YourCompanyHere" InstallerVersion="200" /> <Binary Id="cert" SourceFile="$(var.SourceDir)\mycert.pfx"/> <Directory Id="TARGETDIR" Name="SourceDir"> <Directory Id="MergeRedirectFolder"> <Component Id="certs" Guid="00000000-0000-0000-0000-000000000000"> <CreateFolder/> <iis:Certificate Id="cert" BinaryKey="cert" Name="cert" Overwrite="yes" SoureLocation="localMachine" StoreName="root"/> </Component> </Directory> </Directory> </Module> </Wix>
I now end up with a nice encapsulation ( InstallCertificate.msm ) that I can add to my InstallShield project via the Redistributables tab. Build the MSI and test on a VM proves that it works.
This pattern can also be used with InstallShield 2010 Limited Edition and with a little bit of creative thinking you can quickly get IS2010LE to do all kinds of things that it was crippled to not be able to do. The best part is you are following very good practices while doing it and not trying to hack a solution together like you would be with Visual Studio Deployment Projects and InstallUtil Custom Actions.