我尝试让用户每手设置INSTALLDIR,但文本字段中的值不会转移到INSTALLDIR变量中。 当用户单击浏览按钮并选择目标目录时,它将起作用。
<Product>
...
<Property Id="WIXUI_INSTALLDIR" Value="INSTALLDIR" />
...
</Product>
<Fragment>
<Directory Id="TARGETDIR" Name="SourceDir">
<Directory Id="ProgramFilesFolder">
<Directory Id="INSTALLDIR" Name="HereIAm">
....
</Directory>
</Directory>
</Fragment>
<UI>
...
<Publish Dialog="CustInstallDirDlg" Control="Back" Event="NewDialog" Value="WelcomeDlg">1</Publish>
<Publish Dialog="CustInstallDirDlg" Control="Next" Event="NewDialog" Value="SetupTypeDlg">1</Publish>
<Publish Dialog="CustInstallDirDlg" Control="ChangeFolder" Property="_BrowseProperty" Value="[WIXUI_INSTALLDIR]" Order="1">1</Publish>
<Publish Dialog="CustInstallDirDlg" Control="ChangeFolder" Event="SpawnDialog" Value="BrowseDlg" Order="2">1</Publish>
....
</UI>
<UI>
<Dialog Id="CustInstallDirDlg" Width="370" Height="270" Title="!(loc.InstallDirDlg_Title)">
...
<Control Id="FolderLabel" Type="Text" X="20" Y="60" Width="290" Height="30" NoPrefix="yes" Text="!(loc.InstallDirDlgFolderLabel)" />
<Control Id="Folder" Type="PathEdit" X="20" Y="100" Width="320" Height="18" Property="WIXUI_INSTALLDIR" Indirect="yes" />
<Control Id="ChangeFolder" Type="PushButton" X="20" Y="120" Width="56" Height="17" Text="!(loc.InstallDirDlgChange)" />
</Dialog>
</UI>
但我有另一个领域,我可以在那里编辑我的文字。
<product>
<Property Id="WIXUI_XMLDATASTORE" Value="DATASTOREDIR" />
<CustomAction Id="SetDataStorePath"
Property="WIXUI_XMLDATASTORE"
Value="[DATASTOREDIR]"
Execute="immediate"
/>
<InstallExecuteSequence>
<Custom Action="SetDataStorePath"
Before="InstallInitialize"
/>
</product>
<UI Id="ServiceAccount">
<Dialog Id="ServiceAccountDlg" ...>
...
<Control Id="DataStoreLabel" Type="Text" X="20" Y="150" Width="290" Height="15" NoPrefix="yes"
Text="Please enter Datastore Location" />
<Control Id="CDataStore" Type="PathEdit" X="20" Y="165" Width="220" Height="18" Property="WIXUI_XMLDATASTORE" Indirect="yes"/>
<Control Id="ChangeFolderDS" Type="PushButton" X="250" Y="165" Width="56" Height="17" Text="!(loc.InstallDirDlgChange)" />
</Dialog>
</UI>
<UI>
<Publish Dialog="ServiceAccountDlg" Control="Back" Event="NewDialog" Value="SetupTypeDlg">1</Publish>
<Publish Dialog="ServiceAccountDlg" Control="Next" Event="NewDialog" Value="ISISIPSettingsDlg">1</Publish>
<Publish Dialog="ServiceAccountDlg" Control="ChangeFolderDS" Property="_BrowseProperty" Value="[WIXUI_XMLDATASTORE]" Order="1">1</Publish>
<Publish Dialog="ServiceAccountDlg" Control="ChangeFolderDS" Event="SpawnDialog" Value="BrowseDlg" Order="2">1</Publish>
</UI>
谢谢你, 凯文
答案 0 :(得分:0)
好的,发现了错误。 CustInstallDirDlg中缺少以下行:
<Publish Dialog="CustInstallDirDlg" Control="Next" Event="SetTargetPath" Value="[WIXUI_INSTALLDIR]" Order="1">1</Publish>
现在看起来像这样:
<Publish Dialog="CustInstallDirDlg" Control="Back" Event="NewDialog" Value="WelcomeDlg">1</Publish>
<Publish Dialog="CustInstallDirDlg" Control="Next" Event="SetTargetPath" Value="[WIXUI_INSTALLDIR]" Order="1">1</Publish>
<Publish Dialog="CustInstallDirDlg" Control="Next" Event="NewDialog" Value="SetupTypeDlg">1</Publish>
<Publish Dialog="CustInstallDirDlg" Control="ChangeFolder" Property="_BrowseProperty" Value="[WIXUI_INSTALLDIR]" Order="1">1</Publish>
<Publish Dialog="CustInstallDirDlg" Control="ChangeFolder" Event="SpawnDialog" Value="BrowseDlg" Order="2">1</Publish>