I have been working on setting up a deployment pipeline for a customer using Octopus Deploy. The customer is building an MSI from a Visual Studio 2013 Solution (sadly, by using an old .vdproj, but that's another story). I am wrapping the MSI inside a NuGet package using OctoPack, and publishing it to Octopus internal NuGet repo using NuGet.exe.
I then deploy the package to a given environment using the "Deploy NuGet package" step in Octopus. Now, as a part of the deployment process I also install the MSI using a template from the Octopus Deploy Libray. This template also enables me to uninstall the MSI from the target machine first, if it is installed, which would be a natural step 2 in the deployment process. It uses msiexec to perform operations on the MSI. This is where my question comes in. Consider the following scenario:
When uninstalling the old version I need to provide the template with the path to the MSI I want to uninstall. Let us say that version 1.0 does no longer exist in the target environment. Could I point the template to version 1.1 of the MSI, to uninstall version 1.0?
As far as I have understood from the customer, there has been generated a fixed GUID for the MSI, i.e. the GUID of the MSI would be the same every time Visual Studio produces/builds it. Thus, I am wondering if msiexec uses this GUID to uninstall the MSI, and hence, that it does not matter which version of the MSI I point to in the template to get it uninstalled.
Is this a correct understanding? Appreciate any help and clarifications I can get.
As far as I can tell, the deployment template is just a way to install an MSI with a bunch of parameters that include the path to the MSI and some error messages if it fails.
You do not need the path to an MSI file to uninstall it. All you need is the ProductCode (a guid) and use msiexec /x {ProductCode}
However....when you increment the ProductVersion of the MSI setup project it will prompt you to change ProductCode etc. If you accept this and set the RemovePreviousVersions property to True you will have an upgrade that is a fresh install but that will also uninstall the older product if it's already installed. So if you do that you don't even need to uninstall the older product because installing the new one does that.
So as far as I can tell, all you need do is use the same template to install each MSI product, 1.0, 1.1 etc, and as long as you accept the changes of ProductCode whwn you increment it wall always just install that new one and uninstall the old one at the same time.