WiX 环境组件条件 [英] WiX environment component condition

查看:25
本文介绍了WiX 环境组件条件的处理方法,对大家解决问题具有一定的参考价值,需要的朋友们下面随着小编来一起学习吧!

问题描述

仅在首次安装应用程序时创建环境变量的最佳方法是什么?使用 NOT Installed 属性条件对我来说不起作用.

What is the best way to create environment variable only on first install of the application? Using NOT Installed property condition did't work out for me tho.

推荐答案

自定义操作:您是否为此使用自定义操作?没有必要这样做(针对自定义操作的宣传).MSI 内置了更新环境变量的功能.

Custom Action: Are you using a custom action for this? There is no need to do so (propaganda against custom actions). There are built-in features in MSI to update environment variables.

WiX:使用 WiX 更新 Path 变量非常简单.这是来自 WiX 制造商自己的样本.您需要非常密切关注如何配置它以查看所需的行为.在所有安装模式下进行测试:installrepairself-repairuninstallpatch重大升级等...

WiX: Updating the Path variable using WiX is simple enough. That is a sample from the WiX makers themselves. You need to pay very close attention to how you configure that to see desired behavior. Test in all installation modes: install, repair, self-repair, uninstall, patch, major upgrade, etc...

来自上面链接的内联示例:

Inlining sample from above link:

<Feature Id='Git'>
  <Component Directory='INSTALLFOLDER'>
    <RegistryValue Root='HKLM' Key='Software\Git' Name='InstallFolder' Value='[INSTALLFOLDER]' Type='string' />
    <Environment Id='UpdatePath' Name='PATH' Value='[dir6224ijVLx94XYG2KL6z4YR8qrrs]' Action='set' Part='last' System='yes' />
  </Component>

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