如何确定以前的 WIX Install 安装程序的文件夹
我们产品的现有安装程序不会向注册表写入任何信息,也不写入任何自定义环境变量。允许用户在安装程序的 UI 中更改安装目录。当我进行升级时,如何找出先前版本安装到哪个文件夹中?
我需要知道该文件夹,以便我可以找到以前的配置文件&从中复制值。新版本的配置文件有新的标签和新的结构,所以我不能只保留以前的文件和文件。重复使用它。
托尼
The existing installer for our product does not write any information to the registry, nor does it write any custom environment variables. The user is allowed to change the install directory in the installer's UI. When I'm doing an upgrade, how do I find out what folder the previous version was installed into?
I need to know the folder so I can find the previous configuration file & copy values from it. The new version's configuration file has new tags and a new structure, so I can't just keep the previous file & reuse it.
Tony
如果你对这篇内容有疑问,欢迎到本站社区发帖提问 参与讨论,获取更多帮助,或者扫码二维码加入 Web 技术交流群。
![扫码二维码加入Web技术交流群](/public/img/jiaqun_03.jpg)
绑定邮箱获取回复消息
由于您还没有绑定你的真实邮箱,如果其他用户或者作者回复了您的评论,将不能在第一时间通知您!
发布评论
评论(3)
MSI 没有直接获得该信息。 (MSI 包可以有多个“根”目录,因此无法确定开发人员可能需要哪一个。)如果注册表中有该目录,请使用 注册表搜索。否则,您可以在中使用 MsiGetComponentPath自定义操作。
MSI doesn't have that information directly. (MSI packages can have multiple "root" directories, so there's no telling which one a developer might want.) If you have the directory in the registry, use RegistrySearch. Otherwise, you can use MsiGetComponentPath in a custom action.
我对此进行了一些研究,这是我提出的解决方案:
当安装程序完成安装时,它会在注册表中的路径下创建一个节点,
以便在 32 位操作系统上进行 32 位安装,或在 64 位操作系统上进行 64 位安装,或
在 64 位操作系统上安装 32 位。
该节点包含一个名为 InstallLocation 的值,它为您提供可执行文件的安装路径。
不幸的是,我们的安装程序的早期版本没有设置此属性,因此我无法使用它。但是我们的安装程序创建了一个服务。我已在注册表中找到该服务的节点路径。从那里,我可以检索 ImagePath 值并从服务的 .EXE 文件名中提取路径。
所以我的解决方案是:
托尼
I've done some research into this and here's the solution that I came up with:
When the installer finishes installing, it creates a node in the registry under the path
for 32 bit installs on 32 bit OS or 64 bit installs on 64 bit OS, or
for 32 bit installs on 64 bit OS.
This node contains a value called InstallLocation which gives you the path to where the executables are installed.
Unfortunately, the previous version of our installer did not set this property, so I can't use it. BUT our installer creates a Service. I have found the path to the node in the registry for that service. From there, I can retrieve the value of the ImagePath value and extract the path from the service's .EXE file name.
So my solution is to:
Tony
msiexec 保留上次安装的 msi 副本,因此它将处理卸载以前的版本,您只需包含 InstallExecuteSequence 部分。
这仅在您在 Product 元素中使用相同的 UpgradeCode 属性时才有效。
祝你好运!
msiexec keeps a copy of the msi from the last install so it will handle uninstalling the previous version you will need to just include the InstallExecuteSequence section
This will only work if you are using the same UpgradeCode attribute in your Product Element.
Good Luck!