【问题标题】:Wix install location蜡安装位置
【发布时间】:2016-07-12 11:35:23
【问题描述】:

我有一个允许用户选择安装位置的 WIX 设置。卸载时,我需要运行应该激活安装位置中的文件的自定义操作。我尝试从session["INSTALLDIR"] 获取安装位置,但它会生成默认路径,而不是用户提供的路径。

我怎样才能到达那个位置?

【问题讨论】:

    标签: wix installation uninstallation custom-action


    【解决方案1】:

    我已经在我自己的安装程序中完成了这项工作 - 以下应该可以工作。

    这会添加一个属性以从注册表中检索安装位置值。

    <Property Id="INSTALLDIR">
        <RegistrySearch Id='Registry' Type='raw' Root='HKCU' Key='Software\$(var.Manufacturer)\$(var.ProductName)' Name='Location' />
    </Property>
    

    这会在注册表中设置安装位置。

    <Component Id="Registry" Guid="*">
        <RegistryKey Root="HKCU" Key="Software\$(var.Manufacturer)\$(var.ProductName)">
            <RegistryValue Name="Location" 
                           Type="string" 
                           Value="[INSTALLDIR]" 
                           Action="write" 
                           KeyPath="yes" />
        </RegistryKey>
        <util:RemoveFolderEx On="uninstall" Property="INSTALLDIR" />
    

    【讨论】:

      【解决方案2】:

      如果您希望稍后安装 INSTALLDIR,例如卸载,您应该使用下面链接中描述的记住属性模式。

      “根本问题是 Windows 安装程序不会为您保存属性值。这意味着如果用户在安装 UI 中输入值或在命令行中传递它们,这些值在修复期间将不存在,升级或卸载。”

      http://robmensching.com/blog/posts/2010/5/2/the-wix-toolsets-remember-property-pattern/

      【讨论】:

      • 我添加了注册表值,但无法正确填充它。如何将安装目录设置到属性中?
      猜你喜欢
      • 1970-01-01
      • 1970-01-01
      • 2011-11-29
      • 2013-01-02
      • 1970-01-01
      • 2018-10-22
      • 2013-08-10
      • 1970-01-01
      • 1970-01-01
      相关资源
      最近更新 更多