WiX 环境组件条件 [英] WiX environment component condition
问题描述
仅在首次安装应用程序时创建环境变量的最佳方法是什么?使用 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 制造商自己的样本.您需要非常密切关注如何配置它以查看所需的行为.在所有安装模式下进行测试:install
、repair
、self-repair
、uninstall
、patch
、重大升级
、等...
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>
- WiX 环境元素的文档.
- 这里是实际环境的MSI SDK信息最终 MSI 中的表(Windows 安装程序在安装期间处理的内容 - 原始表).
- The documentation for the WiX Environment element.
- And here is the MSI SDK information for the actual Environment Table in the final MSI (what is processed by Windows Installer during installation - the raw tables).
链接:
这篇关于WiX 环境组件条件的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持IT屋!