如何使用WIX在D盘中创建INSTALLLOCATION文件夹?

时间:2013-01-15 14:25:22

标签: wix

在xml下面创建C:\ Programfiles下的指定文件夹,但我想在D:\ MySetupFolder \中创建(SomeFolder \ MyApp)文件夹,如何使用WIX创建它?

<Directory Id="TARGETDIR" Name="SourceDir">
**<Directory Id="$(var.PlatformProgramFilesFolder)">**      
        <Directory Id="INSTALLFOLDERLOCATION" Name="SomeFolder">
                <Directory Id="INSTALLLOCATION" Name="MyApp">
</Directory>
</Directory>
</Directory>

1 个答案:

答案 0 :(得分:2)

将rootdrive的值设置为您想要的驱动器

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

系统驱动器默认为OS使用的默认驱动器

添加了调用'SetRootDrive'操作的代码:您需要从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>