Logo Questions Linux Laravel Mysql Ubuntu Git Menu
 

Unable to update "PATH" environment variable using WIX

I have used the following wix fragment to update "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 was working initially but now it doesn't update the environment variable. The Verbose log shows the execution of this action and return value 1. Checked after restarting machine. In the log for action FeaturePublish For Feature3 there is garbage value but Installation is successful. Request your help in this...... Thanks a lot....

like image 766
user1512683 Avatar asked Jul 09 '12 18:07

user1512683


1 Answers

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

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

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

like image 182
Nathan Boyd Avatar answered Nov 16 '22 02:11

Nathan Boyd