0
votes

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.

1
Similar, but slightly different. It sounds like they wanted to get the registry value, I already have the value and just need to modify the string slightly. I ended up using a custom action type 38 (inline VBscript) to edit the string value before using it to set my TARGETDIR - user1586574

1 Answers

-1
votes

Split-Path

The Split-Path cmdlet returns only the specified part of a path, such as the parent folder, a subfolder, or a file name

Get-Help Split-Path