How to prepare application setup to make it ready for future upgrades using Installshield LE & Visual Studio 2012

When I was working on one of my projects, I encountered an issue in updating the setup of application which is already installed. Client wanted to have the new setup to install newer version of application without asking the user to remove the existing installed application i.e. older version. So basically the newer version should remove the older version and install newer version automatically without user’s intervention.

There is no straight or prescribed way of doing so using Installshield. It took a lot of R & D over internet to finally arrive to a working solution for same. Hence here I am sharing the same solution so that other people doesn’t need to struggle as much as we did for this fairly simple problem. Let’s dig in…

Creating Setup for First Time

Following are the steps involved in creating setup for the first time:

  1. Add a InstallShield LE Setup project for the application whose setup you need to create from VS Setup & Deployment Project Templates.
  2. Open Project Assistant from Setup project and fill required Application information like company name, application name, application version etc. Application version is basically having four components [Major Version Number.Minor Version Number. Build Number. Revision Number]. For the first time this should be kept as 1.0.0.0 . For further upgrades, we need to increment the minor version every time like 1.01.0.0 then 1.02.0.0 and so on.
  3. Then go to Installation requirements and other listed tabs to fill information accordingly.
  4. In solution explorer, Inside your setup project, you can see there will be an organize your setup menu, from that select General Information.GeneralInfo

Here you can see the eclipse symbol to the right ({..}) of Product Code. Clicking on this basically generates the new code. This symbol will come for both product code & Upgrade code. In case this symbol is not visible to u just click on the product/upgrade code and u will be able to see it. Upgrade Code: this code needs to be kept same for all the versions of an application. Basically one per application (mind it, not one per version). Product Code: this code needs to be changed for each of the version i.e this is one per application version. Other thing i.e. Product version is just same as that which you filled for Application version in Step 2.

Now you can just build the setup project (create Single Image type of Setup) and the exe will be generated which you can install.

Creating Setup for second time and so on

Now lets see what all needs to be changed when a modification is made in application and newer application setup needs to be provided to update older one:

  1. Change Minor Application Version. This can be done either via project Assistant or in general information (it should always be incremented).
  2. Click on the eclipse for Product code so that a new Product  code is generated.
  3. Don’t change Upgrade code.
  4. Go to Upgrade paths (2nd last option under organize your setup). In the left pane there will be an upgrade path already added. Delete that, right click on Upgrade Paths and click on New Upgrade Path option. Once you click that it will ask you to select the previous created setup file. Browse to the setup file under Single Image folder inside your project directory (Make sure to select Setup Exe Files option from file options dropdown at bottom right). Selecting old setup basically ensures that you have same upgrade code as of old setup and this implies that this setup is for upgrading same application by newer version.
  5. This step is required in case you want your related dll & content files to be updated. if you install the setup created in step 4, you will see that your content files will not be replaced with newer files even if you made changes to them. Hence for which ever project dll files you need to be updated, a small change needs to be done every time you create new setup in AssemblyInfo.cs file for each of the projects. Find these two lines in file :
    [assembly: AssemblyVersion("1.0.0.0")]
    [assembly: AssemblyFileVersion("1.0.0.0")]
    Increment the minor version every time for both AssemblyVersion & AssemblyFile Version like
    [assembly: AssemblyVersion("1.01.0.0")]
    [assembly: AssemblyFileVersion("1.01.0.0")]

    This way installer will identify that which all assemblies needs to be updated.

And voila… lastly build the application and now you can install the newer version of the application without removing older version manually.

Advertisements

One thought on “How to prepare application setup to make it ready for future upgrades using Installshield LE & Visual Studio 2012

Leave a Reply

Fill in your details below or click an icon to log in:

WordPress.com Logo

You are commenting using your WordPress.com account. Log Out / Change )

Twitter picture

You are commenting using your Twitter account. Log Out / Change )

Facebook photo

You are commenting using your Facebook account. Log Out / Change )

Google+ photo

You are commenting using your Google+ account. Log Out / Change )

Connecting to %s