Search code examples
visual-studio-2010setup-project

Visual Studio Setup Project Built-In Support for Managing a Directory Name Change


I have a Setup Project that I made using Visual Studio 2010.

The application that I made (and which the Setup Project deploys) has been released for a while now such that there are users that have the application already installed on their machines.

Since the initial release of the application, the company that I work for has changed its name. Without thinking too much about it, I simply changed the [Manufacturer] name in the setup project's Deployment Project Properties to the new company name.

Unfortunately, now when a user updates their existing installation of the application with the new updated application, the directory that was in \Program Files\Old Company Name remains untouched and a new directory \Program Files\New Company Name is created and the new update is installed in this new directory.

It makes sense to me why the scenario above is happening - However, do you know if Visual Studio has options/settings that I can set that will tell the setup project to rename the existing \Program Files\Old Company Name directory to \Program Files\New Company Name and then install the update in that new directory?


Solution

  • If this is an update to the application then, it is really only possible through custom actions as Mark Hall suggests. However if it is a complete installation of the application then it is possible to force a uninstall of the previous version and the reinstall to the new version to the new folder.

    In your Setup Projects properties update your Major version number and allow the "Product code" guid to be updated, ensure that the "RemovePreviousVersion" is true and that the "UpgradeCode" has not changed.

    This should force the uninstall of the previous version and install the new version to the new folder.