仅在满足某些条件时设置Wix属性 [英] Set Wix property only if certain condition is met

查看:59
本文介绍了仅在满足某些条件时设置Wix属性的处理方法,对大家解决问题具有一定的参考价值,需要的朋友们下面随着小编来一起学习吧!

问题描述

我想做的是这样

<Property Id="LICENSEKEYPATH">
      REMOVE~="ALL" AND NOT UPGRADINGPRODUCTCODE
      <DirectorySearch Id="ProgramDataSearch" AssignToProperty="yes" Depth="4" Path="[#ProductDirInAppData]">
        <FileSearch Id="LicenseFileSearch" Name="lic-conf.enp"/>
      </DirectorySearch>
</Property>

仅当我的应用程序被卸载时,我才想搜索许可证文件并获取其路径.当前,尽管代码没有给出任何错误,但是即使我正在安装文件,它仍然会搜索许可证文件路径.因此,安装会延迟很长时间.更重要的是,wix设置会在第一个屏幕中显示,以使其搜索该属性,然后在其他屏幕中继续显示.

When my application is being uninstalled, only then, do I want to search for the license file and get its path. Currently, although the code doesnt give any errors, it still searches for the license file path even when I am installing the file. Because of this, the setup gets delayed by a long time. And more importantly, the wix setup displays in the first screen to the effect that its searching for this property and then it continues with the other screens.

那么,如何仅在卸载期间搜索文件或设置属性的值?

So, how do I search for a file or set the value of a property only during uninstallation?

推荐答案

您可以使用SetProperty元素控制属性的设置.这只是注册自定义动作的捷径.您可以使用文本元素中的Conditoin控制何时执行SetProperty.

You can control the setting of a property using the SetProperty element. That is just a shortcut for registering a custom action. You can control when the SetProperty executes using a Conditoin in the text element.

对于AppSearch(XxxSearch元素),您可以在AppSearch元素中添加上述条件,使其仅在卸载期间运行.请注意,对AppSearch元素进行条件处理将影响所有XxxSearch元素.因此,如果您需要在安装过程中进行搜索,而仅在卸载过程中进行其他搜索,则不可能.

As for AppSearch (XxxSearch elements), you can add a condition like the one above to the AppSearch element so that it only runs during uninstall. Note that the conditioning the AppSearch element will affect all XxxSearch elements. So if you need to have a search working during install and another search only during uninstall, that is not possible.

PS:您想要的条件类似于:

PS: The condition you want will look something like:

Installed AND REMOVE="ALL"

这篇关于仅在满足某些条件时设置Wix属性的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持IT屋!

查看全文
登录 关闭
扫码关注1秒登录
发送“验证码”获取 | 15天全站免登陆