在主要升级期间使用已安装应用程序的位置作为默认路径
我正在为一个应用程序编写主要升级。
唯一持久的就是 UpgradeCode
。 我想要的是使用以前安装版本的位置作为安装的默认路径。
我天真的解决方案是运行一个 CustomAction,它使用由 AppSearch
表获取的变量 APP_LOCATION
修改 INSTALLDIR
。
- 是否有一种传统方法可以通过 MSI 或 InstallShield 实现这一目标?
- 我可以使用 MSI 表中的条件来使用 AppSearch 表中的“APP_LOCATION”(如果它包含值)吗? > 例如:
INSTALLDIR = APP_LOCATION ? APP_LOCATION : MY_DEFAULT_INSTALL_DIR
(语法是为了强调逻辑,idk if 是否有效)
I have an application which I am writing a major upgrade for.
The only thing that is persistent is an UpgradeCode
.
What I want is to use a location of a previously installed version as a default path for installation.
My naive solution is to run a CustomAction which modifies the INSTALLDIR
with a variable APP_LOCATION
obtained by AppSearch
table.
- Is there a conventional way to achive that via means on MSI or InstallShield?
- Can I use a condition in an MSI table to use "APP_LOCATION" from AppSearch table if it contains value? For example:
INSTALLDIR = APP_LOCATION ? APP_LOCATION : MY_DEFAULT_INSTALL_DIR
(syntax is to emphasize the logic, idk if is valid)
如果你对这篇内容有疑问,欢迎到本站社区发帖提问 参与讨论,获取更多帮助,或者扫码二维码加入 Web 技术交流群。

绑定邮箱获取回复消息
由于您还没有绑定你的真实邮箱,如果其他用户或者作者回复了您的评论,将不能在第一时间通知您!
发布评论
评论(1)
您可以使用以下方法获取以前的安装位置:
Msi.GetProductInfo(ProductCode of previous Install, "InstallLocation");
要获取以前安装的产品代码,请使用主要升级时设置的公共属性。此公共属性(例如 OLD_PRODUCT_DETECTED 属性)可以在升级表的 ActionProperty 列中找到。其值将设置为产品代码({GUID})。
确保在 FindRelatedProducts 操作之后调用上述方法,如果找到以前的安装,该操作会将公共属性的值设置为 {GUID}。
You can fetch previous install location using the following method:
Msi.GetProductInfo(ProductCode of previous Install, "InstallLocation");
To get the product code of previous installation, Use the public property set for the major upgrade. This public property for example OLD_PRODUCT_DETECTED property can be found in ActionProperty column of Upgrade table. It's value will be set to product code({GUID}).
Make sure to call the above method after FindRelatedProducts action which sets the value for public property to {GUID} if previous installation found.