7

I need to deploy files in both C and D drives. For example File A goes to drive C and File B goes to drive D. I know that Wix allows you to have only one root directory. Is there any way I can accomplish this?

I know that one solution is to set C as the root directory in the Wix Xml and deploy files that go to C directory through the Wix Xml. The files that have to deployed to D directory then have to be deployed through a custom action.

However I want to avoid using Custom Actions and want to deploy files to both (C and D drives) using the same Wix Xml.

coder
  • 3,205
  • 5
  • 26
  • 14

1 Answers1

14

The entire directory structure should always be wrapped into "TARGETDIR" root. But nobody limits you to define the rest of the structure under it the way you need. See the sample below:

  <Directory Id="TARGETDIR" Name="SourceDir">
     <Directory Id="INSTALLLOCATION" Name="My location">
     ...
     </Directory>
     <Directory Id="DATA_FOLDER" Name="Data">
     ...
     </Directory>
     <Directory Id="DATABASES_FOLDER">
     ...
     <Directory>
  </Directory>

Now you can set DATA_FOLDER or DATABASES_FOLDER to be on a different drive than INSTALLLOCATION. It works fine for me.

Yan Sklyarenko
  • 31,557
  • 24
  • 104
  • 139
  • 1
    can you complete your answer definining for instance DATA_FOLDER to be the system disk (the disk with Windows directory) and not the largest available drive as defined by default on Wix? – dendini Apr 10 '13 at 08:49
  • Taking the largest available drive is not WiX, but Windows Installer behavior. The sample above just defines the directory structure, and unless you set the DATA_FOLDER, for instance, it will fall back to the default Windows Installer behavior. What you are expected to do is to define the DATA_FOLDER by the SetDirectory custom action, or pass the proper value from the command line: `msiexec /i package.msi DATA_FOLDER=...` – Yan Sklyarenko Apr 10 '13 at 09:08
  • Just read your another question, and what you're seeking for probably WindowsVolume MSI property: http://msdn.microsoft.com/en-us/library/windows/desktop/aa372817.aspx – Yan Sklyarenko Apr 10 '13 at 09:11
  • Wow great hint, however can I put it like ? I'll update my other question if you can answer that one we can keep this thread clean. – dendini Apr 10 '13 at 09:51
  • 2
    It is unclear to me how this answer helps. How exactly does one set the location of `DATA_FOLDER` to `D:`? (You cannot set the `Name` to D:\, that is not allowed by the schema) And how does the `WindowsVolume` setting help? (It would be on `C:` by default?) – Klas Mellbourn May 15 '13 at 16:51
  • Take a look at my first comment above. The important part is "What you are expected to do is to define the DATA_FOLDER by the SetDirectory custom action, or pass the proper value from the command line: msiexec /i package.msi DATA_FOLDER=... " – Yan Sklyarenko May 16 '13 at 06:39