How do I ensure my winform application deployment overwrites old versions

后端 未结 4 848
忘了有多久
忘了有多久 2021-01-02 12:28

I have created a msi install package for my project from the VS2008 deployment project. but I am having problems when it comes to upgrading installs, The previously installe

相关标签:
4条回答
  • 2021-01-02 13:00

    We need to set REINSTALLMODE property of our msi file to amus.

    Following is the link to know more about the meaning of 'amus' http://msdn.microsoft.com/en-us/library/aa371182%28VS.85%29.aspx

    There are two ways to do that.

    1. By using msiexec.exe which comes with .NET SDK (if you have VS 2005 or VS 2008 it will come with it, just browse to command prompt of visual studio and you will find it there)

    once you find msiexec.exe just type following command to set REINSTALLMODE property to amus for your installer.

    msiexec.exe /i foo.msi REINSTALLMODE=amus

    0 讨论(0)
  • 2021-01-02 13:19

    Windows Installer has built in checks on your files to make sure that the version is higher than the previous version of that file. If it is not, Windows Installer will not overwrite it. For more extensive info on how Windows Installer handles versioning check out this MSDN article:

    http://msdn.microsoft.com/en-us/library/aa368599%28VS.85%29.aspx

    0 讨论(0)
  • 2021-01-02 13:20
    1. In Visual Studio select your Setup project within the Solution Explorer
    2. Open the Properties Window
      • don't right click and select properties.
      • select View - Properties Window
    3. set RemovePreviousVersions to true
    4. increment the version to a higher number
    5. select yes in the upcoming message box

    If you built and deploy this new setup, a setup with an older version number will be deleted.

    Important: the setup version number is completely independent from your application or assembly version number!

    0 讨论(0)
  • 2021-01-02 13:21

    (Oliver's answer is correct, but I wanted to add pictures and some more details)

    Select the setup project in your solution, then open the Properties pane (the tab next to Toolbox):

    enter image description here

    • Make sure DetectNewerInstalledVersion is true (it is be default)
    • Set InstallAllUsers to true
    • Set RemovePreviousVersions to true
    • Update the Version number and hit Enter
    • After you hit enter, Visual Studio will ask if you want to generate a new GUID for ProductCode, click yes

    Additionally, you need to update the version numbers for each project in your solution, because the installer will only replace DLLs if their version number has been incremented:

    • Open each project's AssemblyInfo.cs and update the AssemblyVersion and AssemblyFileVersion numbers

    Or a better way:

    • Remove AssemblyVersion and AssemblyFileVersion lines from each project's AssemblyInfo.cs
    • Link to a VersionInfo.cs file in your solution with those 2 lines
    • Step-by-step for the above: The Right Way To Version Your Assemblies

    Right-click on the setup project and select Properties (a different Properties dialog):

    • Set Windows Installer 4.5 as a Prerequisite instead of the Visual Studio default of Windows Installer 3.1

    I'm not sure if all of these steps are necessary, and there may be other ways to set this up, but the above steps work for me.

    0 讨论(0)
提交回复
热议问题