Search code examples
.netdeploymentsetup-deployment

How to create an Upgrade installer with the Visual Studio Installer Projects extension


I asked this on the deployment projects QNA

I'm using the Microsoft Visual Studio Installer Projects extension to build a new installer for an update to a 10 year old project, but I cannot seem to create an installer that doesn't require the old version to be removed first.

I'm using VS 2019: if I choose "Install" from the project deployment menu then the new version is installed locally, but if I build it and run the MSI then I get "Another version of this program is already installed…" and will I have to ask my customer to uninstall and reinstall the app. Which they won't like.

I've updated the AssemblyFileVersion and AssemblyVersion properties in the output assembly, but this doesn't help.

So how do I create an update installer? There is no "Publish" menu option on the deployment project, and "Publish" is unavailable on the main menu for the project. The old way would have been to update the product code, but I cannot find a way to do that now in the interface.

I've tried manually changing the product code and package code in the .vdproj file - which lets the installer run, but it won't install because it says a newer version is installed: I've tried generating new GUIDs and manually updating the existing ones, but without success.


Solution

  • The answer was:

    In addition to the changes you made (updating the AssemblyFileVersion and AssemblyVersion properties in the output assembly) you also need to update the version of the setup project.

    1. Select the setup project in solution explorer and hit F4 to bring up the properties
    2. Increase "Version"
    3. Say yes to the dialog that comes up asking if you want to update the Product Code
    4. Save and build the setup project again.

      This will enable the upgrade scenario.

    And this does work. The reason I'm adding it here is that F4 is not listed on the .vdproj context menu so it's effectively undiscoverable.

    There's one more quirk: if you're using Git, then it might not automatically check out the deployment project file (.vdproj), so you have to manually edit it (adding a space is enough) and reload the project, and then make the changes, which rewrites the project anyway.