安装程序不会覆盖现有的应用程序 [英] Installer won't overwrite existing app

查看:83
本文介绍了安装程序不会覆盖现有的应用程序的处理方法,对大家解决问题具有一定的参考价值,需要的朋友们下面随着小编来一起学习吧!

问题描述

我有一个包含 8 个项目的 Visual Studio 2010 解决方案.它还有一个我用来创建安装的安装项目.

I have a Visual Studio 2010 solution with 8 projects. It also has a Setup project which I build to create the installation.

在客户端 PC 上首次安装时,它运行良好.但是,我随后修改了我的项目,并构建了一个新的 Setup,并将其传递给客户端.发生这种情况时,客户端必须首先手动卸载最后一次安装,然后运行安装程序.

It works fine when it's the first installation on a client PC. However, I then modify my project, and build a new Setup, and pass it onto clients. When this happens, the client has to first, manually, uninstall the last installation, and then run the setup.

如果他们在没有卸载的情况下运行安装程序,它似乎不会覆盖现有文件(exe 以及 dll).通常它只是被修改的exe.但是,它不会覆盖它.客户端机器上的版本似乎保持不变.

If they run the setup, without uninstallaing, it seems it doesn't overwrite existing files (exe as well as the dlls). Usually it's just the exe that gets modified. However, it doesn't overwrite it. The version on the client machine seems to stay the same.

有没有办法强制覆盖?

注意,当我修改我的主应用程序项目时,我会转到项目的属性、程序集信息,并增加程序集版本以及文件版本.

Note that when I modify my main application project, I go to the properties of the project, assembly information, and increase the Assembly Version as well as the File Version.

推荐答案

与商业产品相比,visual studio 安装程序并不是对用户最友好的,如果您对安装有很好的控制,甚至 WiX.

The visual studio installer is not the most user friendly compared to commercial products or even WiX if you are after a good level of control over you installation.

当你有一个 Visual Studio 安装项目时,你有几个属性参与升级过程

When you have a Visual Studio Setup project you have several properties that are involved in the Upgrade process

1) 升级代码 - 这是同类安装程序之间的链接,您不应不必要地更改此代码

1) The Upgrade Code - this is the link between installers of the same ilk and you shouldn't change this code needlessly

2) 版本号 - 奇怪的是只有第 1 个 3 号 (major.minor.build) 用于比较(这是很多开发人员常犯的错误)

2) The Version number - strangely only the 1st 3 numbers (major.minor.build) are used for comparison (this is a common mistake that a lot of developers make)

3) 产品代码 - 一旦你改变了版本号 VS 会提示你改变这个数字 - 这样做 - 如果你自动改变数字,记得这样做

3) The Product Code - As soon as you change the version number VS will prompt you to change this number - do it - if you automate the number change remember to do this as well

4) DetectNewerInstalledVersion - 设置为 True

4) DetectNewerInstalledVersion - set to True

5) RemovePreviousVersions - 设置为 True

5) RemovePreviousVersions - set to True

就我个人而言,我会考虑将 WiX 用于如此小的安装,即如果您可以在 Visual Studio 中进行安装,则使用 WiX 版本

Personally I'd look at using WiX for such a small installation i.e. if you can do it in Visual Studio then the WiX version

我的 OpenCover 安装程序如下所示

My installer for OpenCover looks like this

<Wix xmlns="http://schemas.microsoft.com/wix/2006/wi" >

<Product Id="*" Name="OpenCover" Language="1033" Version="!(bind.FileVersion.OPENCOVER_FRAMEWORK_DLL)" 
        Manufacturer="OpenCover @ GitHub" UpgradeCode="2250c3f1-d9ba-44d8-b4db-25f91fe92dc6">

    <Package InstallerVersion="200" Compressed="yes" />

    <Upgrade Id="2250c3f1-d9ba-44d8-b4db-25f91fe92dc6">
        <UpgradeVersion OnlyDetect="no" Property="PREVIOUSFOUND" Minimum="1.0.0.0" IncludeMinimum="yes"
                        Maximum="!(bind.FileVersion.OPENCOVER_FRAMEWORK_DLL)" IncludeMaximum="no" />

        <UpgradeVersion OnlyDetect="yes" Property="NEWERFOUND" Minimum="!(bind.FileVersion.OPENCOVER_FRAMEWORK_DLL)"
                        IncludeMinimum="yes" />
    </Upgrade>

    <Media Id="1" Cabinet="media1.cab" EmbedCab="yes" />

...

</Wix>

希望以上内容对您有用

这篇关于安装程序不会覆盖现有的应用程序的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持IT屋!

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