作为 msi 安装的一部分,如何卸载以前的版本? [英] How to uninstall previous version as part of msi install?

查看:68
本文介绍了作为 msi 安装的一部分,如何卸载以前的版本?的处理方法,对大家解决问题具有一定的参考价值,需要的朋友们下面随着小编来一起学习吧!

问题描述

我有一个打包为 MSI 的产品.当我的客户在现有版本的基础上安装我的产品的新版本时,由于自定义 VBS 操作,它无法正常工作,如下所述.我的问题是:如何更改我的 MSI,以便在顶部安装将始终预先完全卸载任何现有版本?

I have a product that's packaged as an MSI. When my customers install a new version of my product over the top of an existing version it's not working nicely because of a custom VBS action, as explained below. My question is: how I can change my MSI so that installing over the top will always do a full uninstall of any existing version beforehand?

详情是:

我有一个产品,在不同的公司部署了多种版本.大约每年一次,我的每个客户都会收到我产品的新版本并部署到他们公司的工作站上.负责部署的人员希望他们可以在旧版本的基础上安装新版本,而不必在他们的安装包中包含卸载步骤.

I have a product with a variety of versions deployed at various different companies. About once a year each of my customers would receive a new version of my product and deploy to their company's workstations. The people responsible for deployment would prefer they can install the new version over the top of the old version, instead of having to include an uninstall step in their install package.

msi 安装会创建一些文件并将其写入 [CommonApplicationData]\MyApp 文件夹.在执行期间,应用程序会在 [CommonApplicationData]\MyApp 文件夹中创建更多文件.在卸载过程中,我需要删除所有这些文件.由于它们不是由 msi 安装的,因此它们不会自动卸载,因此我创建了一个 vbs 脚本来删除该文件夹以及其中的任何其他内容.我在 ExecuteDeferred 中放置了一个命令来执行该 vbs:

The msi install creates and writes some files to [CommonApplicationData]\MyApp folder. During execution the application creates more files in [CommonApplicationData]\MyApp folder. During uninstall I need to delete all these files. Since they're not installed by the msi they aren't automatically uninstalled, so I created a vbs script that deletes that folder and anything else in it. I put a command to execute that vbs in ExecuteDeferred:

...
RemoveFiles
RemoveFolders
CreateFolders
MoveFiles
InstallFiles
PatchFiles
If REMOVE="ALL" Then
    REM line below is my custom script
    call VBScript From Installation (MyApp_UninstallCleanup)  
End
DuplicateFiles
BindImage
CreateShortcuts
...

到目前为止一切顺利,并且在安装 & 时运行良好正在卸载.但是,如果我在现有版本的顶部安装我的产品的新版本,事情似乎按以下顺序发生:a) 安装新版本,在[CommonApplicationData]\MyApp文件夹下创建各种文件,在[Program Files]\MyApp...,覆盖旧版本的文件b) 运行我的 vbs,删除 [CommonApplicationData]\MyApp 文件夹

So far so good and it works fine when installing & uninstalling. However, if I install a new version of my product over the top of an existing version it appears things happen in this order: a) install new version, creating various files in [CommonApplicationData]\MyApp folder, and in [Program Files]\MyApp..., overwriting files of old version b) run my vbs, deleting the [CommonApplicationData]\MyApp folder

我确实在我的新 MSI 的升级表中列出了旧版本的 GUID,除了这个自定义脚本之外,升级过程似乎工作正常.

I do have the GUIDs for the old versions listed in the Upgrade table in my new MSI, and apart from this custom script the upgrade process seems to work ok.

产品本身非常小,所以如果安装程序总是在安装新版本之前完全删除以前的版本,那就没问题了.工作站上没有用户设置需要保留,文件也不大.因此,为简单起见,我希望卸载以前的版本,而不是仅使用已更改的位进行更新.

The product itself is pretty small so it would be fine if the installer always removed previous versions entirely before installing the new version. There are no user settings on the workstation that need to be retained and the file sizes aren't large. Hence for simplicity I want the previous versions to be uninstalled rather than updated with only the bits that have changed.

有什么方法可以更改我的新 MSI,以便它先卸载以前的版本?

Is there a way I can change my new MSI so that it will uninstall previous versions first?

值得注意的是,我有很多公司安装了包含自定义 vbs 的 MSI 的现有版本.因此,该解决方案确实需要能够应对现有已安装的 msi.

Notably, I have many companies who have the existing version of the MSI installed that contains the custom vbs. So the solution really needs to be one that can cope with the existing installed msi.

我使用 Wise Installation Express 7.0 来创建 MSI.

I've used Wise Installation Express 7.0 to create the MSI.

谢谢!!

(交叉发布此处)

推荐答案

Schedule RemoveExistingProducts<InstallInitialize 动作之前的/code> 动作:

Schedule RemoveExistingProducts action before InstallInitialize action:

在这种情况下,安装程序会在安装新应用程序之前完全删除旧应用程序.这是操作的低效放置,因为必须重新复制所有重复使用的文件.

In this case, the installer removes the old applications entirely before installing the new applications. This is an inefficient placement for the action because all reused files have to be recopied.

这篇关于作为 msi 安装的一部分,如何卸载以前的版本?的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持IT屋!

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