3

It seems that the upgrading installs don't replace files with new versions, but they actually uninstall the old setup package and install the new setup package. Lets imagine that I've installed my application and it generated some files in the install directory. Then the user gets a new version of the product and launches the install package. The package deletes the old version of the product (because the new setup package has "remove previous versions" set to true, higher version number and different product code). The files that were created by application, but not by the package, are not deleted, and this is good. But the user can install the new version to a different location, and then the application won't find the old application files. How do deal with it? Write some custom actions and conditions that skip the folder selecting screen if the application was already installed? Or maybe there is already a built-in way to upgrade the old installed files in the specified directory?

1 Answer 1

2

Your application should not store its settings in Program Files, they should be stored in CommonAppDataFolder, AppDataFolder, or LocalAppDataFolder. If you use one of these folders to store your application settings/data, then users are free to install it to any other location and the app will still see its settings/data.


As far as I understand, the behavior of upgrade depends on where you schedule RemoveExistingProducts action in the install sequence.


Edit: Since you can't change where your application stores its file, you will have to manually keep track of the install locations. When upgrade operation is performed, the updated product will usually be installed to the same location (this may require a change to your Wizard UI).

If you want to preserve the settings even with manual re-installs, i.e. users uninstalled your app, and then installed it again to another location, the only option I see is to store the install location in the registry. If the value does not exist in the registry, your additional actions should not be run. If the value with location of the previous install exists, you save it. Then you move the settings/data from the old location to the new (by adding temporary rows to MoveFile table). In the end you save the new install location to the registry.

Be aware that storing settings/files in Program Files may not work as expected under Windows Vista and above, especially if UAC is on; and your settings may be actually stored in Virtual Store rather than in Program Files. Updating your application would be much better option than trying to move files around.

Sign up to request clarification or add additional context in comments.

1 Comment

That's a good point, but I can't change the way where/how my application stores files.

Your Answer

By clicking “Post Your Answer”, you agree to our terms of service and acknowledge you have read our privacy policy.

Start asking to get answers

Find the answer to your question by asking.

Ask question

Explore related questions

See similar questions with these tags.