Please, can someone provide me with a WiX snippet or solution for the mentioned scenario. I need to include the pfx file in the WiX msi and the user will download my msi to his machine via the internet explorer and Click install and I need also the certificate to be installed on his machine.
You need the Certificate element. It is part of the IIS extension for wix, but can be used for non-IIS related installations also.
You need to
declare a prefix for the iis namespace, for example like this in the root Wix element:
<Wix xmlns='http://schemas.microsoft.com/wix/2006/wi' xmlns:iis='http://schemas.microsoft.com/wix/IIsExtension'>
Embed the PFX file as a binary stream in your install package. Add a Binary element under the product element like this:
<Binary Id="MyCertificateBinaryStream" SourceFile="c:/path/to/mycertificate.pfx" />
Declare a component with a
<iis:Certificate>
element, for example like this. Look at the documentation, you need to fill in some more attributes. Note that you don't needCertficatePath
if you use theBinaryKey
attribute.<Component Id="MyCertificateComponent" Guid="MY-GUID-HERE"> <iis:Certificate Id="MyCertificate" BinaryKey="MyCertificateBinaryStream" ... some more attributes ... /> </Component>
Activate the IIS extension by adding the option
-ext WixIISExtension
option when invoking the wix command line tools. If you use visual studio, this is just a matter of adding a reference in your wix project toWixIISExtension
.