Failed to update PATH environment variable using WIX

I used the following wix snippet to update the "PATH" environment variable.

<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/> 

This worked initially, but now it does not update the environment variable. Verbose log shows the completion of this action and returns a value of 1. Checked after the machine restarts. FeaturePublish's action log for Feature3 has a value for garbage, but the installation was successful. Ask for your help on this ... Thanks a lot ....

+6
source share
1 answer

I think you are using INSTALLLOCATION where you want to use INSTALLDIR. Here is a working example that updates the PATH var environment with the installation directory of a new application.

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

If you intend to use INSTALLLOCATION and defined it elsewhere, then please post the rest of your code and we will go further down the rabbit hole.

+11
source

Source: https://habr.com/ru/post/920063/


All Articles