How do I ensure my winform application deployment overwrites old versions

后端 未结 4 874
忘了有多久
忘了有多久 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: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.

提交回复
热议问题