Page 1 of 2
Uninstall assemblies for .NET 2.0
Posted: Wed May 17, 2006 6:42 am
by RikardG
I'm installing some assemblies into the GAC and using the Install Assembly function. When uninstalling the product the assemblies in the GAC is not deleted.
Posted: Wed May 17, 2006 1:25 pm
by MichaelNesmith
They will be deleted as long as nothing else is using them - Windows Installer tracks all that internally.
Posted: Fri May 19, 2006 3:18 am
by ++good
>They will be deleted as long as nothing else is using them
I am not sure this is true. I created an installer that adds a single dll to the GAC. I then tested it on a clean virtual machine, fresh XP install with only the .NET runtime installed, and the uninstaller did not remove the dll. I am not sure if this is a bug with MSI or InstallAware.
Marcus
Posted: Fri May 19, 2006 3:16 pm
by ++good
Just tried it with Installshield Express, and it also doesn't remove the DLL from the GAC. I guess it is a MSI issues.
Marcus
Posted: Fri May 19, 2006 8:14 pm
by Gizm0
Actually the assembly is never removed, if you don't remove it by yourself..If you are sure that nothing else depends on it, you can use the .NET tools to remove it by command.
Uninstalling assemblies placed in the GAC
Posted: Wed Aug 23, 2006 2:15 pm
by cpursley
Since the install placed the assemblies in the GAC, it should also uninstall the assemblies from the GAC. I can't expect a common user to use a .NET removal tool and uninstall the correct assemblies. How do I automate the install to uninstall these assemeblies?
Re: Uninstalling assemblies placed in the GAC
Posted: Wed Aug 23, 2006 3:45 pm
by Gizm0
cpursley wrote:Since the install placed the assemblies in the GAC, it should also uninstall the assemblies from the GAC. I can't expect a common user to use a .NET removal tool and uninstall the correct assemblies. How do I automate the install to uninstall these assemeblies?
It is a .Net ISSUE, that something placed in the GAC it cannot be removed unless done by the removal tool of the framework.. You have to manualy call the tool for every assembly you want to remove.It's called InstallUtil.exe and it is located in the framework directory eg C:\\WINDOWS\\Microsoft.NET\\Framework\\v2.0.50727. You call it like InstallUtil.exe /u assembly_name and it removes the assembly from the GAC if there is no dependency.
Why doesn't InstallAware automate this process?
Posted: Wed Aug 23, 2006 4:33 pm
by cpursley
Why doesn't InstallAware automate the process of assembly removal?
Re: Why doesn't InstallAware automate this process?
Posted: Thu Aug 24, 2006 1:02 am
by Gizm0
cpursley wrote:Why doesn't InstallAware automate the process of assembly removal?
Because it is against the .Net GAC philoshopy?
If you force the uninstall of an assembly that already has a dependency on the same .dll (let's say you have the same version of a component by a 3rd party vendor) with another application, after uninstallation of your application and removal of the .dll, it will turn the other unusable.
Besides, Microsoft is very clear on that "Put in GAC whatever is going to "stay" on the target machine. Put in the same directory with your application, custom .dll's and stuff that are going to be removed on uninstallation".
Posted: Tue Apr 24, 2007 9:41 am
by alma88
Wise handles the removal of assemblies from the GAC without problem. That is, an assembly is removed as soon as all applications that use it are uninstalled. I just tried several combinations of installing/uninstalling different applications that use one or more of a common set of assemblies, monitored which assemblies are left in the GAC after removing each application, and confirmed that each assembly was properly removed when no application was referencing it any more.
I am spoiled on this since I just switched from Wise. How can I do the same with InstallAware?
Thanks,
Alexander
Posted: Tue Apr 24, 2007 10:17 am
by MichaelNesmith
You can write MSIcode or a DLL or a plug-in which will forcibly uninstall assemblies from the GAC. This is not recommended. I think we had built a DLL like that for a client before, I can try to dig it up for you if you like.
Posted: Tue Apr 24, 2007 11:10 am
by alma88
Does this DLL reproduce the same functionality as the one I described -- I mean, with proper reference counting so that they are removed only when all apps are uninstalled?
Posted: Tue Apr 24, 2007 2:56 pm
by MichaelNesmith
No, I believe it forcibly removes everything that is referenced inside the MSI file.
Posted: Wed Apr 25, 2007 7:02 am
by alma88
MichaelNesmith wrote:They will be deleted as long as nothing else is using them - Windows Installer tracks all that internally.
Maybe I got it wrong and IA does what I want... Will IA delete the assemblies from the GAC upon uninstall if no other installation is referencing them?
Alexander
Posted: Thu Apr 26, 2007 1:37 am
by alma88
Michael,
From "Removal of Assemblies from the Global Assembly Cache"
http://msdn2.microsoft.com/en-us/library/aa371192.aspx:
The installer unpins the assembly when the last Windows Installer client is removed. If the Windows Installer is the last client of the assembly, the common language runtime provides the option to force a synchronous cleanup of the assembly.
This is exactly what I am looking for. From personal experience I know that Wise does it nicely. From reading the InstallShield reference I understand that it does it too; actually it even has a Permanent property that permits us to specify whether the assembly is to be removed or not once it's not referenced any more (
http://support.installshield.com/kb/vie ... id=Q111094).
Your post from about a year ago indicates that IA does it too, but I can't find how to do it. Our IA-installed assemblies are never removed from the GAC. Can you please help me?
Alexander