我需要用户能够为我的安装设置多个不同的目标目录。
我有这个目录结构:
<Directory Id="TARGETDIR" Name="SourceDir">
<Directory Id="ProgramFilesFolder">
<Directory Id="DCOMPANY" Name="MyCompany" >
<Directory Id="DMAIN" Name="MainDir">
<Directory Id="DPART1" Name="Part1"/>
<Directory Id="DPART2" Name="Part2"/>
</Directory>
</Directory>
</Directory>
</Directory>
我这里还有一些属性:
我也有这些属性
<Property Id="WIXUI_INSTALLPATH" Hidden="yes" />
<Property Id="VARIABLE_PATH_DPART1" Value="DPART1" />
<Property Id="VARIABLE_PATH_DPART2" Value="DPART2" />
为了覆盖Single InstallDirDialog,我复制了WIXUI_InstallDir.wxs和InstallDirDlg.wxs文件。我复制了InstallDirDlg.wxs并在文件末尾添加了数字1和2,并将所有三个文件的前缀改为custom_,并相应地更改了它们的UI标签:
现在,在custom_WIXUI_InstallDir.wxs中,我更改了这个块,所以我期望我的属性由操作设置:
<Publish Dialog="LicenseAgreementDlg" Control="Next" Event="NewDialog" Value="custom_InstallDirDlg1">LicenseAccepted = "1"</Publish>
<Publish Dialog="custom_InstallDirDlg1" Control="Back" Event="NewDialog"
Value="LicenseAgreementDlg">1</Publish>
<Publish Dialog="custom_InstallDirDlg1" Control="Next"
Event="SetTargetPath" Value="[VARIABLE_PATH_DPART1]" Order="1">1</Publish>
<Publish Dialog="custom_InstallDirDlg1" Control="Next" Event="DoAction"
Value="WixUIValidatePath" Order="2">NOT WIXUI_DONTVALIDATEPATH</Publish>
<Publish Dialog="custom_InstallDirDlg1" Control="Next" Event="SpawnDialog"
Value="InvalidDirDlg" Order="3"><![CDATA[NOT WIXUI_DONTVALIDATEPATH AND
WIXUI_INSTALLDIR_VALID<>"1"]]></Publish>
<Publish Dialog="custom_InstallDirDlg1" Control="Next" Event="DoAction"
Value="InvalidDirDlg" Order="3"><![CDATA[NOT WIXUI_DONTVALIDATEPATH AND
WIXUI_INSTALLDIR_VALID<>"1"]]></Publish>
<Publish Dialog="custom_InstallDirDlg1" Control="Next" Event="NewDialog"
Value="VerifyReadyDlg" Order="4">WIXUI_DONTVALIDATEPATH OR
WIXUI_INSTALLDIR_VALID="1"</Publish>
<Publish Dialog="custom_InstallDirDlg1" Control="ChangeFolder"
Property="_BrowseProperty" Value="[VARIABLE_PATH_DPART1]"
Order="1">1</Publish>
<Publish Dialog="custom_InstallDirDlg1" Control="ChangeFolder"
Event="SpawnDialog" Value="BrowseDlg" Order="2">1</Publish>
<Publish Dialog="VerifyReadyDlg" Control="Back" Event="NewDialog"
Value="custom_InstallDirDlg1" Order="1">NOT Installed</Publish>
在custom_InstallDirDlg1.wxs中,我也将此行更改为我的路径变量:
<Control Id="Folder" Type="PathEdit" X="20" Y="100" Width="320"
Height="18" Property="VARIABLE_PATH_DPART1" Indirect="yes" />
当我现在编译时,所有的东西都被创建了,当我运行安装程序时,当我点击“更改…”按钮或“下一步…”按钮时,安装程序会冻结大约30秒钟,然后显示“指定的路径DPART1不可用。”
当我查看所有那些CDATA块中调用的自定义操作的源代码时,我发现它们只关心WIXUI_INSTALLPATH,并且不接受任何给它们的东西。所以这基本上是使用间接寻址来实现的。
我也在某个地方读到过,这个对话框可以被重用,让用户输入多个目标路径,但我想不出怎么做。
请帮忙 :)