Install to same path when upgrading application

-Right click the Setup Project
-View
-Registry
-In the left side, expand the HKey_Local_Machine and Software and click the Manufacturer node
-In the right side, right click and Add String registry key
-Name the registry key InstallDir
-Set its value [TARGETDIR].

enter image description here

After the program is installed you can see the InstallDir regkey contains the location. Your updater application can use this same path.

enter image description here

Generally the only difference between “Just Me” and “Everyone” is the location of the shortcuts that are created. You can run Process Monitor during an install and see for yourself.

EDIT:

The updater application can use the InstallDir RegistryKey with these steps. Ref: How to: Use a Registry Launch Condition to Specify a Target Directory

-Right click the Setup Project of your Updater
-View
-Launch Conditions
-Add a Search For RegistryKey
-Specify the Property as SEARCHFORINSTALLDIR
-Specify the RegKey as SOFTWARE\ManufacturerName
-Leave root pointing to HKLM
-Specify the Value as InstallDir

enter image description here

-Add a Launch Condition
-Specify the condition as SEARCHFORINSTALLDIR
-Leave InstallUrl and Message

enter image description here

-Right click the Setup Project
-View
-File System
-Select Application Folder
-Press F4 to view the properties of the Application Folder
-Specify the DefaultLocation as [SEARCHFORINSTALLDIR]

enter image description here

Now when you Build the Setup package for the Updater and run it, it will give you the value in the InstallDir regkey for the install path.

If you wish to disable the “Folder Textbox” and the “Browse” button to prevent users from changing the updaters install path you can use Orca.exe. Orca is a database table editor for creating and editing Windows Installer packages and merge modules. Then simply follow this setup project, fixing the location of installed kit


Another way you could do this is following Aaron Stebner’s How to modify the default install path in an MSI-based setup based on a registry value

Leave a Comment