39

在完成 WIX 教程后,我仍然不知道如何将 installdir 添加到 Windows 系统变量的 PATH 中。

我试着用

  Environment Id='UpdatePath' Action='create' Name='PATH'  System='yes' Value='[INSTALLDIR]' 

但是安装程序后路径没有变化。我几乎无法在任何地方找到 WIX 的示例代码。请帮助我,非常感谢!

4

3 回答 3

54

您应该能够使用:

<Environment Id="PATH" Name="PATH" Value="[INSTALLDIR]" Permanent="yes" Part="last" Action="set" System="yes" />

这应该向环境路径添加一个新条目,设置为[INSTALLDIR].

于 2009-12-19T01:34:24.287 回答
22

还有一点需要注意的是,Environment需要放在一个有目录的组件里面,例如

<DirectoryRef Id="TARGETDIR">
  <Component Id="Path" Guid="{xxx-xxx-xxx-xxx}">
    <Environment Id="PATH" Name="PATH" Value="[INSTALLDIR]" Permanent="no" Part="last" Action="set" System="no" />
  </Component>
</DirectoryRef>

环境元素中描述的 Wix 元素的详细信息

于 2012-07-06T06:22:47.223 回答
2

有同样的问题,这对我有用:

        <Directory Id="TARGETDIR" Name="SourceDir">
            <Directory Id="ProgramFilesFolder">
                <Directory Id="INSTALLFOLDER" Name="DataBaseds_Service_Installer" />
            </Directory>
        </Directory>

    <ComponentGroup Id="Components" Directory="INSTALLFOLDER">

      ...some components  
    </ComponentGroup>

    <DirectoryRef Id="TARGETDIR">
      <Component Id="MYSQL_PASSWORD" Guid="..."
        <Environment Id=HERE YOU CAN ADD THIS  :)/>
      </Component>      
    </DirectoryRef>
于 2017-09-22T13:44:12.353 回答