Upgrade install with GAC'd assemblies - Advanced Installer Community

We’re moving our forums to a new platform.

You can still browse and search existing topics, but you can no longer create new topics or post replies.

For questions, technical issues, or feature requests, please don’t hesitate to contact our support team at support@advancedinstaller.com.

Thank you for your understanding!

aaronz
Posts: 2
Joined: Tue Nov 24, 2009 9:02 pm

Upgrade install with GAC'd assemblies

I'm having an issue with my installer when performing an upgrade. It appears that others on this forum are having similar issues, but none of the recommendations in those posts appear to be working for me.

I have an installer that will correctly install my assemblies into the Global Assembly Cache (GAC) and remove them on an uninstall. However, when performing an upgrade (because I've versioned my installer) the original assemblies are being removed from the GAC (due to the uninstall) but they are not being readded during the install. However, if I subsequently Repair my installation the files get properly GAC'd.

NOTE: The version of my assemblies hasn't necessarily changed between installation packages, but I may have updated the code therein. I want to ensure that the correct, updated assemblies get added to the GAC. I have tried changing the order (from Uninstall older version first and then install new version to Install new version first and then uninstall old version) but that leaves the old assemblies in the GAC (because of matching versions, I believe) so I don't think this is an option for me.

I've also tried the Ensure that this file overwrites any installed target file option to no avail.

What can I do to ensure that the updated assemblies are properly registered in the GAC after an upgrade?
GabrielBarbu
Posts: 2146
Joined: Thu Jul 09, 2009 11:24 am
Contact: Website

Re: Upgrade install with GAC'd assemblies

Hello,

You should always increment the version of your assemblies whenever their implementation has changed to ensure that the new assemblies replace the old ones.
This way Windows Installer will see that the assemblies are changed and it will automatically update them

Regards,
Gabriel
Gabriel Barbu
Advanced Installer Team
http://www.advancedinstaller.com/
aaronz
Posts: 2
Joined: Tue Nov 24, 2009 9:02 pm

Re: Upgrade install with GAC'd assemblies

Gabriel,

Thanks for your reply.

While I am fully aware of and understand the principles of assembly versioning, there are times (particularly during development and testing) where changing the assembly version is simply not practical. Not only might there be other applications on the test machine that rely on the assemblies with a particular version stamp, but there may be there may be configuration files with references to the GAC'd assemblies scattered throughout out. Basically I want to make a small tweak or bug fix to my assembly and install it to test it in a test environment without having to upgrade all dependencies, config files, etc.

Is there a way in Advanced Installer to have my installer application upgrade a previously installed application (removing the older GAC'd assemblies) and install the new ones irrespective of version?

This is what appears to be happening:

First Install
- assemblies in install package are GAC'd
Upgrade Install
- removes previous installation first, so the GAC'd assemblies are removed
- assemblies in upgrade package are not installed in GAC

The net effect on an upgrade where the assembly versions match is that the assemblies are removed from the GAC. It doesn't seem like the correct behavior to have the installer not GAC the assemblies after an upgrade completes, particularly when the installer specifies that they should be.

As mentioned previously, if a Uninstall first and then Reinstall it works. Also, if I were to Upgrade and then Repair it works. The issue seems to be happening only on an upgrade by itself.
Cosmin
Posts: 5797
Joined: Tue Jul 10, 2007 6:39 pm
Contact: Website

Re: Upgrade install with GAC'd assemblies

Hi,
Is there a way in Advanced Installer to have my installer application upgrade a previously installed application (removing the older GAC'd assemblies) and install the new ones irrespective of version?
A solution which doesn't involve changing the assemblies versions is to manually uninstall the old package before installing the new one. You can also try using an Uninstall previous versions custom action to automatically uninstall the old version before the new installation starts.
It doesn't seem like the correct behavior to have the installer not GAC the assemblies after an upgrade completes, particularly when the installer specifies that they should be.
This behavior is caused by a known bug in Windows Installer. Basically, if the version doesn't change Windows Installer sees the assemblies as installed and doesn't install them anymore. But the upgrade removes the original assemblies, so they are missing in the end.

Regards,
Cosmin
Cosmin Pirvu - Advanced Installer Team
Follow us: Twitter - Facebook - YouTube
harry
Posts: 4
Joined: Fri Feb 05, 2010 6:26 am

Re: Upgrade install with GAC'd assemblies

Hi,

Manual uninstalling the old package or using the "Uninstall previous versions" custom action has a side effect. The registry key of my product is deleted as well. Some of the user settings that are saved in the registry key are lost after upgrade.

I found another approach to solve this problem. In Assemblies page, I set the Version attribute for the assembly which version is not changed to a new version number and make sure the "Synchronize value with the assembly file" is unchecked. This action will not change the actual version number stored in the assembly. But it seems to "cheat" the Windows Installer this assembly has a new version number so that the Windows Installer replaces the existing assembly with the new one.

Is there anyone knows whether this approach has any side effects?

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

Re: Upgrade install with GAC'd assemblies

Hi Harry,
The registry key of my product is deleted as well. Some of the user settings that are saved in the registry key are lost after upgrade.
This happens because the old product is uninstalled. A solution would be to use backup and restore custom actions. The User Guide contains the Preserve registry key at install how-to which may help you.
In Assemblies page, I set the Version attribute for the assembly which version is not changed to a new version number and make sure the "Synchronize value with the assembly file" is unchecked. This action will not change the actual version number stored in the assembly. But it seems to "cheat" the Windows Installer this assembly has a new version number so that the Windows Installer replaces the existing assembly with the new one.

Is there anyone knows whether this approach has any side effects?
This is not a recommended approach because the information inside the MSI no longer matches the actual assembly. I'm not sure if Windows Installer uses the version to keep track of the installed assemblies, but you can further test this approach (uninstall and upgrade the package) to determine if it can cause problems.

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

Return to “Common Problems”