4

The only way that I know of to change the TARGETDIR is to uninstall and then install the same application again. Note that I need to have the MSI package at hand for that.

I would like to add support in my MSI packages to change the TARGETDIR of the application after it was installed. This feature would be triggered by the Change option from the Add/Remove window. When choosing that option, beside the ability to change features, the user would also be able to change the TARGETDIR folder.

Is that possible?

Thanks.

i_am_jorf
  • 53,608
  • 15
  • 131
  • 222
drowa
  • 682
  • 5
  • 13
  • As Chris explains this is impossible. Please explain why this is necessary, so we can determine if there is another way to achieve what you want. – Stein Åsmul Apr 22 '14 at 00:45
  • Well, imagine a situation where an user wants to move the installation folder of an application while not having the installation package available. A natural path would be to go to the 'Add/Remove' window and select the 'change' option. – drowa Apr 22 '14 at 20:28
  • Are you thinking in terms of moving a large install to a new drive due to lack of disk space or what is the rationale for moving the folder at all? – Stein Åsmul Apr 22 '14 at 21:23
  • I used to deploy Web applications using MSI packages. The MSI would extract the files, create an application in IIS and etc. The application folder (TARGETDIR) was configurable during the installation/upgrade (major), but not in maintenance mode. Some times an administrator would call me asking to move the application folder, for reasons I don't recall. Note I don't use MSI packages to deploy Web applications anymore. – drowa Apr 24 '14 at 04:06

1 Answers1

5

No, it's not possible. All directory properties ( including INSTALLDIR, TARGETDIR, INSTALLLOCATION or whatever else you call them ) are immutable once they have a component installed that references them. You have to uninstall anywhere from a select feature to the entire product (depending on which features have components using the directories ) in order to be able to reinstall the feature / product and give the directory a new value.

Christopher Painter
  • 54,556
  • 6
  • 63
  • 100