简体   繁体   English

Visual Studio 2010 安装项目 - 对现有安装的小更新

[英]Visual Studio 2010 Setup Project - Minor update to an existing installation

I have created a WPF app in Visual Studio 2010. I have also created a Setup Project to install this app.我在 Visual Studio 2010 中创建了一个 WPF 应用程序。我还创建了一个安装项目来安装这个应用程序。 The Setup Project handles prerequisites, copies the binaries, populates start menu and desktop, sets up file associations and icons, etc. All this is working great.安装项目处理先决条件,复制二进制文件,填充开始菜单和桌面,设置文件关联和图标等。所有这些都很好。

I am now working on an updater, which should update my app to a higher minor version (bug fixes, etc).我现在正在开发一个更新程序,它应该将我的应用程序更新到更高的次要版本(错误修复等)。 I am using the NetSparkle framework to handle the update process.我正在使用 NetSparkle 框架来处理更新过程。 I've got the process itself working, but I am having issues creating an update MSI file that does what I want.我已经让该过程本身正常工作,但是在创建执行我想要的更新 MSI 文件时遇到问题。

Here is what I have tried:这是我尝试过的:

  1. I created a second Setup Project, with the purpose of building the "update" MSI file.我创建了第二个安装项目,目的是构建“更新”MSI 文件。 All it does is copies new binaries.它所做的只是复制新的二进制文件。 It has a one-screen UI, and obviously does not handle prerequisites, shortcuts, icons, file associations, etc.它具有单屏 UI,显然不处理先决条件、快捷方式、图标、文件关联等。
  2. I have made sure the UpgradeCode is the same as my main installer Setup Project's UpgradeCode我已确保UpgradeCode与我的主安装程序安装项目的 UpgradeCode 相同
  3. I have set the Version to be higher than that of my main installer Setup Project我已将Version设置为高于我的主安装程序安装项目的版本

So I build the updater MSI, and plug it into the NetSparkle update process.所以我构建了更新程序 MSI,并将其插入 NetSparkle 更新过程。 It seems to work BUT it is creating a second entry for my App in Control Panel Programs and Features (with the higher version number), and it also seems to be resetting the configuration settings for my App - I need those to stay intact, As I said, this is just a minor bug fix update.它似乎可以工作,但它正在为我的应用程序在控制面板程序和功能(具有更高版本号)中创建第二个条目,并且它似乎也在重置我的应用程序的配置设置 - 我需要这些设置保持不变,因为我说,这只是一个小错误修复更新。 not a completely new replacement.不是一个全新的替代品。

What am I doing wrong?我究竟做错了什么? Can somebody point me in the right direction?有人可以指出我正确的方向吗? Do I even need an MSI to just update files?我什至需要 MSI 来更新文件吗? (Should I be using a Patch instead? If so, how do I go about creating one?) (我应该改用补丁吗?如果是这样,我该如何创建一个补丁?)

UPDATE: I've been playing around with RemovePreviousVersions .更新:我一直在玩RemovePreviousVersions If I set it to false , the result is as described above.如果我将其设置为false ,则结果如上所述。 If I set it to true , then the duplicate entry in Programs and Features is gone, but it also removes all the file associations, icons, start menu and desktops links, etc, which is not what I want.如果我将它设置为true ,那么 Programs and Features 中的重复条目就会消失,但它也会删除所有文件关联、图标、开始菜单和桌面链接等,这不是我想要的。 It also breaks the NetSparkle process, in that the app is not automatically relaunched.它还破坏了 NetSparkle 进程,因为该应用程序不会自动重新启动。 Really, all I want to do is overwrite the installation files, and that's it, regardless of whether the user is upgrading up one minor version or X minor versions.真的,我想要做的就是覆盖安装文件,就是这样,无论用户是升级一个次要版本还是 X 次要版本。

I'd recommend taking a look at something like WIX to do this.我建议看看像WIX这样的东西来做到这一点。 The VS Setup project works for simple stuff, but it's tricky to handle the nuances of MSI installs. VS Setup 项目适用于简单的东西,但处理 MSI 安装的细微差别很棘手。 With WIX you get fine-grained control over the MSI.使用WIX ,您可以对 MSI 进行细粒度控制。

To get started, you can use one of their tools to import your existing MSI, or you can start with one of their templates to get started.要开始,您可以使用他们的工具之一来导入现有的 MSI,或者您可以从他们的模板之一开始。 I initially started by importing from the VS setup and then copied portions into one of the WIX templates.我最初从 VS 设置导入,然后将部分复制到 WIX 模板之一。

Their site has some good info on the upgrade process in their documentation .他们的网站在他们的文档中有一些关于升级过程的好信息。

Here's a post that talks about the pros and cons of a minor upgrade .这是一篇讨论小升级的利弊的帖子。 And another wix tutorial related to wix .以及另一个wix相关的wix教程

In my case, I wanted to support minor upgrades too.就我而言,我也想支持小升级。 I use the following in my WIX file to control the upgrade detection logic:我在我的 WIX 文件中使用以下内容来控制升级检测逻辑:

    <!-- 
        This upgrade table will control how and when the installer detect a major upgrade.
    -->
    <Upgrade Id="$(var.UpgradeCode)">
        <UpgradeVersion Minimum="$(var.ProductVersion)" Property="NEWPRODUCTFOUND" OnlyDetect="yes" IncludeMinimum="no" />
        <UpgradeVersion Minimum="1.0.0" Maximum="$(var.ProductVersion)" Property="UPGRADEFOUND" IncludeMinimum="yes" IncludeMaximum="no" />
    </Upgrade>

When setting RemovePreviousVersions to true you are using a major upgrade .将 RemovePreviousVersions 设置为 true 时,您正在使用重大升级 So the old version is automatically uninstalled by your new one.所以旧版本会被你的新版本自动卸载。 If you want to use a major upgrade, your new version should be a complete and standalone installer (it includes prerequisites, shortcuts, icons, file associations, etc.).如果您想使用重大升级,您的新版本应该是一个完整且独立的安装程序(它包括先决条件、快捷方式、图标、文件关联等)。

What you describe is patching .你描述的是补丁 Visual Studio doesn't support patches, so you will need to create them manually. Visual Studio 不支持补丁,因此您需要手动创建它们。 If you want an easier solution, there are commercial setup authoring tools which offer direct support for both an updater and patches.如果您想要一个更简单的解决方案,可以使用商业设置创作工具,它们为更新程序和补丁提供直接支持。

声明:本站的技术帖子网页,遵循CC BY-SA 4.0协议,如果您需要转载,请注明本站网址或者原文地址。任何问题请咨询:yoyou2525@163.com.

 
粤ICP备18138465号  © 2020-2024 STACKOOM.COM