Israel
Posts: 14
Joined: Mon Dec 17, 2007 2:53 pm

Using /SetVersion from the command line

Hi,

I'm running Advanced Installer.com in order to set the version number from a file.
I do NOT add the parameter -noproducecode. When I do so I'm required to uninstall the old version before installing the new one.

My aip file is set to 'Automatically upgrade old versions'.

When I install a new version of my application, it is installed over the old version (which is OK), but my application appears twice in the 'Add / Remove Programs' panel, once for each version.

When I set the new version manually in the aip file (and reply YES to produce a new product code), the old version of my application is uninstalled during the installation of the new version, and my application appears only once in the 'Add / Remove Programs' panel.

How can I solve this problem?

Thanks,

Israel
Cosmin
Posts: 5797
Joined: Tue Jul 10, 2007 6:39 pm
Contact: Website

Hi,

For upgrading an installation you have two possibilities:
1) you use a patch
2) you use the automated upgrade feature

1) A patch project is basically the difference between two MSI packages (which makes it very small) and you can use it to update an installation. You can read more about patches here:
http://www.advancedinstaller.com/user-g ... oject.html
http://www.advancedinstaller.com/user-g ... tches.html
http://www.advancedinstaller.com/user-g ... patch.html

2) The automated upgrade feature works like this:
- you install a MSI on the target machine,
- you increase it's version and update some of it's files
- you answer "Yes" when changing the Product Code
- when running the updated MSI on the target machine the old installation will be removed and the updated package will be installed

Since you are using the automated upgrade feature, the new version will be installed after it automatically uninstalls the old version.
When I install a new version of my application, it is installed over the old version (which is OK), but my application appears twice in the 'Add / Remove Programs' panel, once for each version.
This is because you have not created the upgraded MSI by modifying the old one. in this case the upgraded MSI is seen by Windows Installer as a new independent installation, therefore a new entry is created in "Add/Remove Programs".
How can I solve this problem?
Please try to follow the steps I mentioned above in order to use the automated upgrade feature.

Regards,
Cosmin
Cosmin Pirvu - Advanced Installer Team
Follow us: Twitter - Facebook - YouTube
DevMountain
Posts: 9
Joined: Mon Feb 04, 2008 11:44 am

That doesn't help

I found this post via Google.

The answer suggested is not adequate in my opinion.

I am running AI from FinalBuilder in an attempt to fully automate our build process. I therefore need to be able to do the steps below without user interaction.

I can from the command line modify the version number to 0.0.0.0 and then back to the value I want which replicated Israel's original issue (i.e. setup is allowed to run and installs over previous one, but then appears twice in add remove programs).

I don't want to use patches as we distribute a full install each time.

Please can you provide an alternate solution?
Cosmin
Posts: 5797
Joined: Tue Jul 10, 2007 6:39 pm
Contact: Website

Hi,

The solution is the one I explained in my previous post. Here are the steps:
- make the necessary modifications to the original AIP
- increase the version by using the /SetVersion command:
http://www.advancedinstaller.com/user-g ... rsion.html
- this command will automatically generate a new Product Code
- build the package

Now, the generated package will upgrade the old one.

However, I'm not sure what exactly you need to do since there is no user interaction. How will the automated build know what modifications need to be done to the AIP for the upgraded version?

Regards,
Cosmin
Cosmin Pirvu - Advanced Installer Team
Follow us: Twitter - Facebook - YouTube
DevMountain
Posts: 9
Joined: Mon Feb 04, 2008 11:44 am

Thanks for the really fast reply.

The automated build knows which version to set as it reads the version number from the assembly directly and then uses the SetVersion to change it. I do this in code, script and via AI command line.

I think the version number model in AI is different to how we want to use it.

e.g....
- internally I release 1.0.1 to the QA team (the build version is 1.0.1234.567 which I set in the assembly).
- QA team pick up issues and I want to release another build of 1.0.1 (build version is now 1.0.1234.568)
- the only way I can get this installed over the old 1.0.1 is to change the version number (I change it to 0.0.0 via command line) then back to 1.0.1 via command line.

Doing this does allow for the installation of the new 1.0.1 over the old, but it appears twice in the add/remove programs. If I change the version to 1.0.2 through the problem doesn't manifest (i.e. 1.0.1 is upgraded OK and replaced by 1.0.2).

Thanks in advance...
Cosmin
Posts: 5797
Joined: Tue Jul 10, 2007 6:39 pm
Contact: Website

Hi,

Please note that your method generates two different packages, not an upgrade for an older package.

In order to use the automated upgrade feature you need to increase the version of the upgraded package directly, not by setting it to 0 and then modifying it.

In your case this doesn't work because you are increasing the fourth field of the version. Note that this field is ignored by Windows Installer, therefore you must increase the third field of the version.

This way you will have the 1.0.1234 and the 1.0.1235 version. Now the 1.0.1235 version will automatically upgrade the older version.

Regards,
Cosmin
Cosmin Pirvu - Advanced Installer Team
Follow us: Twitter - Facebook - YouTube
DevMountain
Posts: 9
Joined: Mon Feb 04, 2008 11:44 am

Ah - I see.

This is not really an issue for builds that leave our team, but it is for intermediate builds (i.e. where we don't increase the third digit as it only goes to QA).

I also understand that this is a WI issue and not your fault :o

Do you happen to know by chance, how windows installer checks for existing versions - does it look in the registry or to the files to be installed directly? I might be able to find a way of overriding this check when passing files to the QA team.
Quadiago
Posts: 71
Joined: Thu May 31, 2007 9:07 am

We've developed a workaround for the same problem at our company. It involves having a bootstrap for the MSI which checks what the installed version of the application is, compares it to the version in the new MSI, and if only the build version has been incremented, it uninstalls the old version and then installs the new version. It is obviously inefficient, but it does simplify the life of R&D.

This can all be done using a variety of MSI API calls.
Cosmin
Posts: 5797
Joined: Tue Jul 10, 2007 6:39 pm
Contact: Website

Hi,
Do you happen to know by chance, how windows installer checks for existing versions
Windows Installer detects existing versions of an application by using the registry. However, the version of the new upgraded package is detected by using the ProductVersion property in the new package.

Note that it is not recommended to modify the registry entries which store the version of the old installation. Therefore, the best approach is the one suggested by Quadiago.

Regards,
Cosmin
Cosmin Pirvu - Advanced Installer Team
Follow us: Twitter - Facebook - YouTube

Return to “Common Problems”