I'm creating an MSI installer for a program and want to allow people to upgrade their installation instead of always uninstalling/reinstalling.
I've gotten most of it down, but now I want to automatically set the TARGETDIR (or install directory) to be wherever the user had previously installed the application.
In Visual Studio, under Launch Conditions -> Search Target Machine, I find a registry entry named ISUPGRADE that contains the previously installed location (if it's installed), but has a /bin/XXXX.dll appended to it. I want to remove the end of this string and set it as the TARGETDIR so that the upgrade will install there.
I can set a static string in as TARGETDIR (in CustomActions and referencing the action in InstallExecuteSequence and InstallUISequence) but I'm stuck as to how to set it with my variable.
How can I do this? I'm using Visual Studio to produce the .msi file and a Powershell script (Orca for manual/testing edits) to make changes to the file.