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

发布于 2024-11-25 14:21:20 字数 943 浏览 2 评论 0原文

我在 Visual Studio 2010 中创建了一个 WPF 应用程序。我还创建了一个安装项目来安装此应用程序。安装项目处理先决条件、复制二进制文件、填充开始菜单和桌面、设置文件关联和图标等。所有这些都运行良好。

我现在正在开发一个更新程序,它应该将我的应用程序更新到更高的次要版本(错误修复等)。我正在使用 NetSparkle 框架来处理更新过程。我已经让该过程本身正常工作,但在创建执行我想要的操作的更新 MSI 文件时遇到问题。

这是我尝试过的:

  1. 我创建了第二个安装项目,目的是构建“更新”MSI 文件。它所做的只是复制新的二进制文件。它有一个单屏用户界面,显然不处理先决条件、快捷方式、图标、文件关联等。
  2. 主安装程序安装项目的 UpgradeCode 相同
  3. 我已确保 UpgradeCode 与我设置的 版本 高于我的主安装程序安装项目的版本,

因此我构建了更新程序 MSI,并将其插入 NetSparkle 更新过程。它似乎有效,但它正在控制面板程序和功能中为我的应用程序创建一个第二条目(具有更高的版本号),并且它似乎还正在重置我的应用程序的配置设置 - 我需要那些保持完好无损!正如我所说,这只是一个小错误修复更新,而不是全新的替代品。

我做错了什么?有人能指出我正确的方向吗?我是否需要 MSI 来更新文件? (我应该使用补丁吗?如果是这样,我该如何创建一个补丁?)

更新:我一直在使用 RemovePreviousVersions。如果我将其设置为false,结果如上所述。如果我将其设置为 true,那么程序和功能中的重复条目就会消失,但它也会删除所有文件关联、图标、开始菜单和桌面链接等,这不是我想要的。它还破坏了 NetSparkle 进程,因为该应用程序不会自动重新启动。实际上,我想做的就是覆盖安装文件,仅此而已,无论用户是升级一个小版本还是 X 个小版本。

I have created a WPF app in Visual Studio 2010. I have also created a Setup Project to install this app. 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. I've got the process itself working, but I am having issues creating an update MSI file that does what I want.

Here is what I have tried:

  1. I created a second Setup Project, with the purpose of building the "update" MSI file. All it does is copies new binaries. It has a one-screen UI, and obviously does not handle prerequisites, shortcuts, icons, file associations, etc.
  2. I have made sure the UpgradeCode is the same as my main installer Setup Project's UpgradeCode
  3. I have set the Version to be higher than that of my main installer Setup Project

So I build the updater MSI, and plug it into the NetSparkle update process. 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? (Should I be using a Patch instead? If so, how do I go about creating one?)

UPDATE: I've been playing around with RemovePreviousVersions. If I set it to false, the result is as described above. 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. It also breaks the NetSparkle process, in that the app is not automatically relaunched. 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.

如果你对这篇内容有疑问,欢迎到本站社区发帖提问 参与讨论,获取更多帮助,或者扫码二维码加入 Web 技术交流群。

扫码二维码加入Web技术交流群

发布评论

需要 登录 才能够评论, 你可以免费 注册 一个本站的账号。

评论(2

南冥有猫 2024-12-02 14:21:20

我建议您看看 WIX 之类的东西来执行此操作。 VS 安装项目适用于简单的事情,但处理 MSI 安装的细微差别却很棘手。使用 WIX,您可以对 MSI 进行细粒度控制。

首先,您可以使用他们的工具之一导入现有的 MSI,也可以从他们的模板之一开始。我一开始是从 VS 安装程序导入,然后将部分内容复制到 WIX 模板之一中。

他们的网站文档中提供了一些有关升级过程的有用信息

这是一篇讨论小幅升级的优缺点。还有另一个与wix相关的wix教程

就我而言,我也想支持较小的升级。我在 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>

I'd recommend taking a look at something like WIX to do this. The VS Setup project works for simple stuff, but it's tricky to handle the nuances of MSI installs. With WIX you get fine-grained control over the 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. I initially started by importing from the VS setup and then copied portions into one of the WIX templates.

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.

In my case, I wanted to support minor upgrades too. I use the following in my WIX file to control the upgrade detection logic:

    <!-- 
        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>
简美 2024-12-02 14:21:20

将RemovePreviousVersions 设置为 true 时,您正在使用主要升级。因此,旧版本会被新版本自动卸载。如果您想使用主要升级,您的新版本应该是完整且独立的安装程序(它包括先决条件、快捷方式、图标、文件关联等)。

您所描述的是修补。 Visual Studio 不支持补丁,因此您需要手动创建它们。如果您想要更简单的解决方案,可以使用商业设置创作工具,它们为更新程序和补丁提供直接支持。

When setting RemovePreviousVersions to true you are using a major upgrade. 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. If you want an easier solution, there are commercial setup authoring tools which offer direct support for both an updater and patches.

~没有更多了~
我们使用 Cookies 和其他技术来定制您的体验包括您的登录状态等。通过阅读我们的 隐私政策 了解更多相关信息。 单击 接受 或继续使用网站,即表示您同意使用 Cookies 和您的相关数据。
原文