我已使用以下 wix 片段来更新“PATH”环境变量。
<DirectoryRef Id="MyDir">
<Component Id ="setEnviroment"
Guid=" xxxxx">
<CreateFolder />
<Environment Id="SET_ENV"
Action="set"
Name="PATH"
Part="last"
Permanent="no"
System="yes"
Value="[INSTALLLOCATION]" />
</Component>
</DirectoryRef>
<Feature Id="Feature3" Title="3Feature"
Level="1"
Absent="disallow"
AllowAdvertise="no">
<ComponentRef Id="setEnviroment"/>
</Feature>
<InstallExecuteSequence>
<WriteEnvironmentStrings/>
<InstallExecuteSequence/>
这最初是有效的,但现在它不会更新环境变量。详细日志显示此操作的执行并返回值 1。重新启动机器后检查。在操作 FeaturePublish For Feature3 的日志中有垃圾值,但安装成功。请求您的帮助......非常感谢......