Wix:如何在自定义安装位置进行 DirectorySearch
我想检测用户在 GUI 中选择的自定义安装位置中是否已存在目录。我尝试了以下操作:
<Property Id="DIRECTORY_PATH">
<DirectorySearch Id="DirectorySearch" Path="[INSTALLDIR]\MyDirectory" />
</Property>
但这不起作用,因为 DirectorySearch 是在 AppSearch 期间发生的。而 INSTALLDIR 是稍后在 InstallDirDlg 期间设置的。由于未及时为 AppSearch 设置 INSTALLDIR,因此 DIRECTORY_PATH 被错误地设置为“\MyDirectory”。
我尝试更改当 AppSearch 与 InstallUISequence 和 InstallExecuteSequence 一起发生时,但它只会让 AppSearch 在 CostInitialize 之前出现,不会更晚。
那么如何在用户选择的 INSTALLDIR 位置进行目录搜索呢?
I would like to detect if a directory already exists in a custom installation location selected by the user in the GUI. I tried the following:
<Property Id="DIRECTORY_PATH">
<DirectorySearch Id="DirectorySearch" Path="[INSTALLDIR]\MyDirectory" />
</Property>
But this doesn't work because the DirectorySearch is happening during AppSearch. While INSTALLDIR is set later during InstallDirDlg. Since INSTALLDIR is not set in time for AppSearch, DIRECTORY_PATH is incorrectly set to "\MyDirectory".
I tried to change when AppSearch happens with InstallUISequence and InstallExecuteSequence, but it will only let AppSearch come before CostInitialize, no later.
So how do I do a directory search at the user selected INSTALLDIR location?
如果你对这篇内容有疑问,欢迎到本站社区发帖提问 参与讨论,获取更多帮助,或者扫码二维码加入 Web 技术交流群。
绑定邮箱获取回复消息
由于您还没有绑定你的真实邮箱,如果其他用户或者作者回复了您的评论,将不能在第一时间通知您!
发布评论
评论(2)
如果您只需等待用户选择来验证该目录,那么 DirectorySearch 将无法为您完成这项工作。您必须在用户选择 INSTALLDIR 后立即编写“设置属性”自定义操作,例如,在下一步单击 InstallDirDlg 时。
更新。所以,我的意思基本上如下:
session["DIRECTORY_PATH"] = session[INSTALLDIR] + "\MyDirectory";
NOT DIRECTORY_PATH
)希望它能让它更清楚。
If you only have to wait for the user's choice to verify that directory, then DirectorySearch won't do the job for you. You'll have to author a "set property" custom action right after the user chooses INSTALLDIR, for instance, on a Next click of InstallDirDlg.
UPDATE. So, I mean basically the following:
session["DIRECTORY_PATH"] = session[INSTALLDIR] + "\MyDirectory";
NOT DIRECTORY_PATH
)Hope it makes it clearer.
希望这会对您有所帮助。
如果您在注册表中存储了以前安装的INSTALLDIR,则可以获取并搜索它。在安装 UI 序列中,安装位置将指向先前的位置。
Hope this will help you.
If you have stored the INSTALLDIR of previous installation in registry, you can get it and search for it. In the Install UI sequence the Installtion location will point to previous location.