使用 WiX 在 Windows 的用户存储中安装 pfx 证书 [英] Install a pfx certificate in a users store in Windows using WiX

查看:22
本文介绍了使用 WiX 在 Windows 的用户存储中安装 pfx 证书的处理方法,对大家解决问题具有一定的参考价值,需要的朋友们下面随着小编来一起学习吧!

问题描述

请有人为我提供上述场景的 WiX 片段或解决方案.我需要在 WiX msi 中包含 pfx 文件,用户将通过 Internet Explorer 将我的 msi 下载到他的机器上,然后单击安装,我还需要在他的机器上安装证书.

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.

推荐答案

你需要 证书元素.它是 wix 的 IIS 扩展的一部分,但也可用于非 IIS 相关的安装.

You need the Certificate element. It is part of the IIS extension for wix, but can be used for non-IIS related installations also.

你需要

  1. 为 iis 命名空间声明一个前缀,用于像这样在根 Wix 元素中的示例:

  1. 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'>

  • 将 PFX 文件嵌入为二进制文件在您的安装包中流式传输.添加Binary 元素像这样的产品元素:

  • 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" />
    

  • <iis:Certificate> 元素声明一个组件,用于像这样的例子.看着那(这文档,需要填写一些更多属性.请注意,如果您使用 BinaryKey 属性,则不需要 CertficatePath.

  • 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 need CertficatePath if you use the BinaryKey attribute.

    <Component Id="MyCertificateComponent" Guid="MY-GUID-HERE">
       <iis:Certificate Id="MyCertificate"
          BinaryKey="MyCertificateBinaryStream"
          ... some more attributes ...                  
       />
    </Component>
    

  • 通过添加激活 IIS 扩展选项 -ext WixIISExtension调用 wix 命令行工具时的选项.如果您使用 Visual Studio,只需在您的 wix 项目中添加对 WixIISExtension 的引用即可.

  • 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 to WixIISExtension.

    这篇关于使用 WiX 在 Windows 的用户存储中安装 pfx 证书的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持IT屋!

  • 查看全文
    登录 关闭
    扫码关注1秒登录
    发送“验证码”获取 | 15天全站免登陆