1

For some reason, my WIX installer does not seem to work when I run this command:

msiexec.exe /i "C:\Users\XXX\XX-Debug-x64.msi" TARGETDIR="C:\Installation Test1" /qn

I get the Windows Installer help box showing what commands I can use. If I run the installer manually, I can change the destination path to whatever I want and it'll install correctly. I don't understand why this isn't happening through msiexec powershell? Using WIX 3.5 as an FYI.

I have tried TARGETDIR, INSTALLDIR, INSTALLPATH... nothing works

My wix fragment is here:

<Fragment>
  <Directory Id="TARGETDIR" Name="SourceDir">

  <!-- Start Menu Directory -->
  <Directory Id="ProgramMenuFolder">
    <Directory Id="InstallProgramMenuFolder" Name="!(loc.ProductName_Folder)"/>
  </Directory>

  <?if $(var.Platform)=x64?>
    <!-- Program files folder -->
    <Directory Id="ProgramFiles64Folder">
      <Directory Id="APPLICATIONROOT" Name="!(loc.ProductName_RootFolder)">
        <Directory Id="INSTALLFOLDER" Name="!(loc.ProductName_Folder)" />
      </Directory>
    </Directory>
  <?else?>
    <!-- Program files folder -->
    <Directory Id="ProgramFilesFolder">
      <Directory Id="APPLICATIONROOT" Name="!(loc.ProductName_RootFolder)">
        <Directory Id="INSTALLFOLDER" Name="!(loc.ProductName_Folder)" />
      </Directory>
    </Directory>
  <?endif?>

</Directory>

All that happens is this gets brought up

enter image description here

Extra snipped from the log

MSI (s) (68:E8) [14:50:34:401]: Note: 1: 2205 2:  3: Condition 
MSI (s) (68:E8) [14:50:34:401]: PROPERTY CHANGE: Modifying TARGETDIR property. Its current value is 'C:\Installation Test'. Its new value: 'C:\Installation Test\'.
MSI (s) (68:E8) [14:50:34:401]: PROPERTY CHANGE: Adding InstallProgramMenuFolder property. Its value is 'C:\ProgramData\Microsoft\Windows\Start Menu\Programs\Bob Bob\'.
MSI (s) (68:E8) [14:50:34:401]: PROPERTY CHANGE: Adding APPLICATIONROOT property. Its value is 'C:\Program Files\Bob\'.
MSI (s) (68:E8) [14:50:34:401]: PROPERTY CHANGE: Adding INSTALLFOLDER property. Its value is 'C:\Program Files\Bob\Bob Bob\'.
MSI (s) (68:E8) [14:50:34:401]: PROPERTY CHANGE: Adding dir0B6DC86EBAB610CFD56B476ECDD18AF2 property. Its value is 'C:\Program Files\Bob\Bob Bob\Config\'.
MSI (s) (68:E8) [14:50:34:401]: Target path resolution complete. Dumping Directory table...
MSI (s) (68:E8) [14:50:34:401]: Note: target paths subject to change (via custom actions or browsing)
MSI (s) (68:E8) [14:50:34:401]: Dir (target): Key: TARGETDIR    , Object: C:\Installation Test\
MSI (s) (68:E8) [14:50:34:401]: Dir (target): Key: WindowsFolder    , Object: C:\WINDOWS\
MSI (s) (68:E8) [14:50:34:401]: Dir (target): Key: ProgramMenuFolder    , Object: C:\ProgramData\Microsoft\Windows\Start Menu\Programs\
MSI (s) (68:E8) [14:50:34:401]: Dir (target): Key: InstallProgramMenuFolder , Object: C:\ProgramData\Microsoft\Windows\Start Menu\Programs\Bob Bob\
MSI (s) (68:E8) [14:50:34:402]: Dir (target): Key: ProgramFiles64Folder , Object: C:\Program Files\
MSI (s) (68:E8) [14:50:34:402]: Dir (target): Key: APPLICATIONROOT  , Object: C:\Program Files\Bob\
MSI (s) (68:E8) [14:50:34:402]: Dir (target): Key: INSTALLFOLDER    , Object: C:\Program Files\Bob\Bob Bob\
MSI (s) (68:E8) [14:50:34:402]: Dir (target): Key: dir0B6DC86EBAB610CFD56B476ECDD18AF2  , Object: C:\Program Files\Bob\Bob Bob\Config\
bobsyauncle
  • 152
  • 8
  • Does it spit out an error? – Isaac May 27 '20 at 12:45
  • [Perhaps have a look here](https://stackoverflow.com/a/47813195)? (all answers in there). And adding [this answer on logging](https://stackoverflow.com/a/54458890/129130) - recommend you give it a quick read - helps debugging in the future. – Stein Åsmul May 27 '20 at 13:09
  • Nope, no error. It doesn't even do anything but bring up the help panel. See the image in edit – bobsyauncle May 27 '20 at 13:25
  • Then there is an actual error in the command line, and not just a wrong setting or value - in other words a "syntax error". Verify the full path to the MSI first of all. – Stein Åsmul May 27 '20 at 13:31
  • It's not a syntax error. If I run it in cmd it works but ignores the TARGETDIR. I can see in the msiexec log that TARGETDIR = C:\Installation Test, but Wix seems to change it to ProgramFiles based on the above fragment i posted – bobsyauncle May 27 '20 at 13:44
  • In my fragment above, there is a condition that checks if it's 64 bit or not and installs in the program files directory based on that. But I don't believe TARGETDIR is getting utilised? Not sure if there is a way to say, if TARGETDIR is specified in the command line, use that, else do what i'm doing above. I don't know enough about wix to understand that tbh – bobsyauncle May 27 '20 at 13:47
  • Any idea what i might be doing wrong? – bobsyauncle May 27 '20 at 14:45
  • Try to use ```APPLICATIONROOT``` instead of ```TARGETDIR```: msiexec.exe /i "C:\Users\XXX\XX-Debug-x64.msi" APPLICATIONROOT="C:\Installation Test1" /qn – Vadim Jun 02 '20 at 08:28
  • problem with that is you only get one subdir, not 2 i.e. i want the custom install to have application root and the install folder under it – bobsyauncle Jun 02 '20 at 13:34

0 Answers0