0

I am deploying one MSI via msiexec.exe, but when I specify the path=D:\folder_name, the folder is not created.

Code:

<Fragment>
     <Directory Id="TARGETDIR" Name="SourceDir">
       <Directory Id="INSTALLDIR" Name="bin" />
      </Directory>
   </Fragment>

From the above code, I can achieve folder "bin" but I want that "bin" should go into the folder which will get created via msiexec.exe i.e

msiexec.exe /i /path/to/msi /quiet PATH=Drive/Folder_name

Can we have a workaround so that if the folder is not present then it should create it and should put the "bin" in that folder?

Tom Blodget
  • 20,260
  • 3
  • 39
  • 72
  • Understanding MSI directory resolution is not trivial. Under doubt, [here are some suggestions on how to override directories in MSI installations](https://stackoverflow.com/q/48464105/129130). I would test well in all installation modes if you go down this "advanced directory resolution" path. The suggestion in the answer below to set TARGETDIR at the command line should work though - if all you want is to install all files to D:\Something (and not just a few files - in which case you must redirect a single folder or a group of folders - see the linked answer in this comment). – Stein Åsmul Jan 30 '18 at 21:18
  • msiexec allows you to pass in the value of public properties. Directories are public properties. As the answers explain, setting PATH doesn't do what you want because it isn't a property used in the way you think. – Tom Blodget Jan 30 '18 at 22:27

2 Answers2

1

You need to specify the TARGETDIR and not PATH. Try the following:

msiexec.exe /i /path/to/msi TARGETDIR="DRIVE/Folder_name" /qb
Chris N.
  • 41
  • 5
1

It's not clear what you're asking because:

  1. Why is PATH in your msiexec command line? If you want to specify the actual directory you should perhaps be using INSTALLDIR=....

  2. The Directory element seems incomplete. Typically you'd have something like:

Directory Id="TARGETDIR"   Name="SourceDir">
  <Directory Id="ProgramFilesFolder">
    <Directory Id="INSTALLDIR"  Name="MyName">
      <Directory Id="MYDIR"   Name="Fred" />
    </Directory>
  </Directory>
</Directory>

and use INSTALLDIR in the command line to specify the name within ProgramFiles or TARGETDIR to customize the entire path, or MYDIR to change the name "Fred".

To get to the question: a folder is created by specifying that files will be installed there. Maybe more of your source would show that.

If you want to create an empty directory it's done with a CreateFolder element inside a component, as here in the WiX docs:

Creating an empty folder

This is not in your question, but silent installs that require elevation will fail because silent means that the UAC elevation prompt will not be shown, and the install will proceed with limited privileges and fail.

PhilDW
  • 20,260
  • 1
  • 18
  • 28