WiX — Installing files to system drive

2019-04-09 00:25发布

I'm working on an installer that drops some files into another application that keeps its files at [SystemDrive]\appName. The installer is only used in internal automation, so it's fine if it doesn't consider other install locations.

I've found that by default WiX sets the target directory to the drive with the most free space. What's the best way to specify a certain directory in the system drive instead?

标签: wix
2条回答
一纸荒年 Trace。
2楼-- · 2019-04-09 01:12

Set the value of rootdrive to the drive you want

<CustomAction Id='SetRootDrive' Property='ROOTDRIVE' Value='[%SystemDrive]\'/>

System drive will be by default the default drive used by OS

Added code to call 'SetRootDrive' action: You need to call it from InstallUISequence

<InstallUISequence>
  <Show Dialog="MyWelcomeDlg" Before="CostFinalize">NOT Installed</Show>
  <!-- App search is what does FindInstallLocation, and it is dependent on FindRelatedProducts -->
  <AppSearch After="FindRelatedProducts"/>
  <Custom Action="SetRootDrive" Before="CostInitialize"></Custom>
</InstallUISequence>
查看更多
一纸荒年 Trace。
3楼-- · 2019-04-09 01:14

MSI already gives you the value in the WindowsVolume property. Use that as the parent Directory/@Id.

查看更多
登录 后发表回答