Visual Studio安装项目:更新不起作用 [英] visual studio setup project : update doesn't work

查看:525
本文介绍了Visual Studio安装项目:更新不起作用的处理方法,对大家解决问题具有一定的参考价值,需要的朋友们下面随着小编来一起学习吧!

问题描述

几天来我一直面临一个问题,经过大量研究,我找不到适合我情况的任何东西.

I am facing a problem for several days and after many research I couldn't find anything that fit with my case.

这是东西: 我正在与Visual Studio 2010合作开发一个包含多个项目和一个安装项目的解决方案.我希望安装项目创建一个MSI文件,以将产品从版本1.5更新到版本1.6.

Here's the thing : I'm working with Visual Studio 2010 on a solution that contains several projects and a Setup Project. I want the setup project to create a MSI file to update the product from version 1.5 to version 1.6.

我遵循了本教程 http://www .simple-talk.com/dotnet/visual-studio/updates-to-setup-projects/并还更新了解决方案每个项目的程序集版本和文件版本号.

I followed this tutorial http://www.simple-talk.com/dotnet/visual-studio/updates-to-setup-projects/ and updated also the assembly version and file version numbers of each project of the solution.

我的安装项目的设置为:
DetectNewerInstalledVersion:正确
InstallAllUsers:
RemovePreviousVersions:正确
版本: 1.6.3
产品代码与先前版本的产品代码不同
和UpgradeCode与先前版本的UpgradeCode相同.

The settings of my Setup Project are :
DetectNewerInstalledVersion : True
InstallAllUsers : True
RemovePreviousVersions : True
Version : 1.6.3
The ProductCode is different from the ProductCode of the previous version
and UpgradeCode is the same than the UpgradeCode of the previous version.

我读到,通常MSI应该删除版本比现有版本新的文件,并用新文件替换.而且,当我运行以前的MSI(将产品从1.4更新到1.5的MSI)时,它可以按所述正常工作. (我不确定它是用哪个版本的Visual Studio编译的,但我想它是在VS2008中使用的.)

I read that normally the MSI should remove the files which version is newer than the existing ones and replace with the new ones. And when I run the previous MSI (those which updates the product from 1.4 to 1.5) it works just fine as described. (I'm not sure with which version of visual studio it was compiled but I guess it's with VS2008).

现在,当我运行我的MSI时,它似乎首先运行将旧.exe替换为新.exe的安装序列",然后运行擦除.exe的卸载序列".当安装完成"时,我的应用程序目录中没有更多的.exe. (但是,在添加/删除程序"面板中,该产品适用于版本1.6中安装的产品.)

Now when I run my MSI, it seems that it first runs the "installation sequence" that replace the old .exe with the new ones, and then it runs the "uninstall sequence" that erase the .exe. And when the install is "finished" there is no more .exe in my application directory. (However in the "Add/Remove Programs" Panel the product apppears as installed in version 1.6).

(注意:我可以注意到MSI的安装"部分或卸载"部分正在运行,因为它们都有打开控制台应用程序的自定义操作,我可以在其中进行跟踪.)

(NB : I can notice when the "install" part or "uninstall" part of the MSI is running because both have Custom Actions that open a Console Application in which I can have a trace).

经过更多研究,我将旧的MSI与我的ORCA进行了比较,我发现表InstallExecuteSequence中的差异:
使用旧的MSI,RemoveExistingProducts的序列号为 1525 ,介于InstallInitialize(1500)和AllocateRegistrySpace(1550)之间.
使用我的MSI,RemoveExistingProducts的序列号为 6550 ,介于InstallExecute(6500)和InstallFinalize(6600)之间.
我在表中看不到任何其他差异.

After more research I compared the old MSI with mine whith ORCA and I noticed differences in the table InstallExecuteSequence :
With the old MSI, the sequence number of RemoveExistingProducts is 1525 that is between InstallInitialize (1500) and AllocateRegistrySpace (1550).
With my MSI, the sequence number of RemoveExistingProducts is 6550 that is between InstallExecute (6500) and InstallFinalize (6600).
I can't see any other differencies in the table.

我什至尝试使用ORCA MSI进行手动编辑,并将RemoveExistingProduct的序列号设置为1525.在执行时,卸载部分"正确运行,但随后出现2356错误(经过一些研究,我猜这是因为手动编辑MSI损坏了它.

I even tried to edit manually with ORCA the MSI and put the sequence number of RemoveExistingProduct to 1525. At the execution the "uninstall part" ran correctly but then I got a 2356 Error (after a few research I guess this is because editing manually the MSI corrupted it).

如果有人有一个想法可以解释我的MSI的行为以及如何解决它?

If anyone have an idea that explains the behaviour of my MSI and how to fix it?

谢谢

推荐答案

这似乎是该插件的错误 "Microsoft Visual Studio 2017安装程序项目". 使用错误的序列号(太高)构建了msi文件.在安装新文件后 会卸载旧产品,因此会错误地删除新文件.

This appears to be a bug with the plugin "Microsoft Visual Studio 2017 Installer Projects". The msi file gets built with an incorrect sequence number (too high). The uninstall of older products happens after the install of new files, so new files get incorrectly deleted.

手动修复:更改顺序,以便在安装新产品之前卸载旧产品.

Manual fix: Change the sequence so that uninstall of old products happens before the install of new items.

  • 使用orca.exe(或任何适用于您的编辑器)打开msi
  • 转到InstallExecuteSequence表
  • 更改RemoveExistingProducts 序列号,使其介于InstallValidate和 InstallInitialize.例如,我将其从6550更改为1450.
  • open the msi with orca.exe (or whatever editor works for you)
  • go to the InstallExecuteSequence table
  • change the RemoveExistingProducts sequence number so that it is between InstallValidate and InstallInitialize. For example, I changed it from 6550 to 1450.

我最终创建了一个简单的脚本,以在后期构建步骤中自动进行此修复.您可以在github上找到它... InstallerStuff

I ended up creating a simple script to do this fix automatically as a post build step. You can get on github it here... InstallerStuff

这篇关于Visual Studio安装项目:更新不起作用的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持IT屋!

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