Using Remove Assemblies

Got a problem you cannot solve? Try here.
jtjohnson
Posts: 15
Joined: Wed Jun 21, 2006 12:06 pm

Using Remove Assemblies

Postby jtjohnson » Sat Jun 23, 2007 4:55 pm

Hi,

I'm trying to remove assemblies out of the GAC that were put there by my install script; but using the "Remove Unpinned Assemblies" command after the "Apply Uninstall" doesn't remove those assemblies.

I've tried rebooting my computer before and after the uninstall but the assemblies are still there.

I originally used the Install Assemblies command twice on the same set of files; once to copy to Program Files and again to copy them to the GAC. I've tried changing it to using Install Assemblies only to install to the GAC and Install Files to copy to the Program Files directory. Still no go.

Any ideas what I could be doing wrong? If it matters this setup was originally created in IA5.3 and was just opened up in IA6.6 yesterday.

Thanks,

James

H4nd0
Posts: 92
Joined: Thu Nov 09, 2006 8:16 am
Location: Sydney, AU
Contact:

Postby H4nd0 » Sat Jun 23, 2007 8:21 pm

I've never had any success with installing assemblies into the GAC (as you found out you need to double copy everything). I've tested removing unpinned assemblies in 6.6 and it doesn't appear to do anything. The other mess that you run into is versioning in the GAC. IA can't cleanup a heirarchy of assemblies after an upgrade or patch for instance.

Hence (!) my workaround is to install the native assemblies into my install directories. Then I shell out and run my own script which cleans up the GAC via NGEN before compiling the new assemblies into the GAC. The second reason for using a script is that I can log all the progress. Doesn't appear to be possible via IA (unless you use the /l=filename flag ... and then everything gets logged).
FireDaemon Technologies Limited
http://www.firedaemon.com

jtjohnson
Posts: 15
Joined: Wed Jun 21, 2006 12:06 pm

Postby jtjohnson » Sat Jun 23, 2007 11:59 pm

H4nd0 wrote:I've never had any success with installing assemblies into the GAC (as you found out you need to double copy everything). I've tested removing unpinned assemblies in 6.6 and it doesn't appear to do anything. The other mess that you run into is versioning in the GAC. IA can't cleanup a heirarchy of assemblies after an upgrade or patch for instance.


In my case I double copy the assemblies because my company produces a component for developers to use and Visual Studio requires the assemblies to be placed in the file system to add a reference. We also produce an add-in to Visual Studio so in order to avoid making additional copies I GAC the assemblies so Visual Studio can find them.

After some more looking around it looks like the GACd assemblies don't get the right Install Reference applied to them. Enumerating (via the Fusion API) the Install References for my assemblies returns nothing; but doing so for assemblies installed by Microsoft setup apps (Visual Studio and Office assemblies) shows Windows Installer as the Installer Reference.

jtjohnson
Posts: 15
Joined: Wed Jun 21, 2006 12:06 pm

Postby jtjohnson » Sun Jun 24, 2007 12:08 am

jtjohnson wrote:After some more looking around it looks like the GACd assemblies don't get the right Install Reference applied to them. Enumerating (via the Fusion API) the Install References for my assemblies returns nothing; but doing so for assemblies installed by Microsoft setup apps (Visual Studio and Office assemblies) shows Windows Installer as the Installer Reference.


Oops, I forgot to mention why I did this. I was exploring the possibility of just calling the UninstallAssembly function in the Fusion API; but found that it removes the assembly even if two setups have GAC'd the file without either being uninstalled. I think this is due to the missing Installer Reference in my last post.

James

jtjohnson
Posts: 15
Joined: Wed Jun 21, 2006 12:06 pm

Postby jtjohnson » Mon Jun 25, 2007 11:30 am

I think we're getting closer to what is going on. We have another product that is using IA6.2 and I double checked the behavior there and found that the assemblies were being removed on uninstall.

One major difference between our products is that mine is now compiling for .NET 2.0 while the other is .NET 1.1. We also first noticed this happening after we made the switch from .NET 1.1 to .NET 2.0.

Something I found while writing a utility was that I could not get my assemblies to uninstall unless I gave fusion the entire display name of the assembly plus the processorArchitecture field that is present on all of the .NET 2.0+ assemblies I have.

So I did a little test; I've created a basic setup that installs two assemblies to the GAC, one is written in .NET 2.0, the other in .NET 1.1. When I run the setup both are added to the GAC as expected. On uninstall only the .NET 1.1 assembly is removed.

A colleague found a previous thread where this processorArchitecture flag caused problems in an earlier build of IA when installing assemblies.

I have attached an IA6.6 project that runs my test. The .NET 2.0 assembly is named DataDynamics.MyStrongNamedAssembly while the .NET 1.1 assembly is just called TestAssembly.

File Attached:

My dotNET Setup.zip

MichaelNesmith
Posts: 3452
Joined: Thu Dec 22, 2005 7:17 pm
Contact:

Postby MichaelNesmith » Tue Jun 26, 2007 11:10 am

Thanks for the reproducible test case! I've escalated to R&D.
Michael Nesmith
InstallAware
Home of The Next Generation MSI Installer
Get your free copy today - http://www.installaware.com/

jtjohnson
Posts: 15
Joined: Wed Jun 21, 2006 12:06 pm

Postby jtjohnson » Wed Jul 18, 2007 1:27 pm

Hi Michael,

Has there been any progress on this?

Thanks,

James

alma88
Posts: 38
Joined: Wed Apr 18, 2007 5:38 am

Postby alma88 » Fri Aug 03, 2007 4:30 pm

Is the removal of .NET 2.0 assemblies from GAC supposed to be working fine now? Our assemblies are not being removed (I am using IA7) and so I am wondering if there is still a problem with this functionality or if I am the one doing something wrong.

Alexander

Gizm0
Posts: 339
Joined: Wed Nov 09, 2005 8:47 pm

Postby Gizm0 » Tue Aug 07, 2007 1:59 pm

Hello,

I did an investigation on this. It turned out that assemblies DO remove ALWAYS for Net 1.1 but it fails for some 2.0 assemblies. The reason it fails is that sometimes, Windows Installer, corrupts the Global registry cache, and thus there is always a reference to an even unreferenced assembly. The solution is to DELETE the (Default) registry key from the follow to paths ->
HKEY_CURRENT_USER\\Software\\Microsoft\\Installer\\Assemblies\\Global
HKEY_LOCAL_MACHINE\\Software\\Classes\\Installer\\Assemblies\\Global
before trying anything.

Imo though, is better to delete the registry above, and call the gacutil /uf assemblyname for 1.1 or ngen uninstall /f assemblyname for .net 2.0 assemblies by Run Program, so you get your assemblies removed for sure. It's not an IA bug either , it's a strange behavior from Windows Installer, which is going to be fixed on Windows Installer 4.5 (introduced on VISTA SP1, and Windows 2008 Server etc..).
Panagiotis Kefalidis
Software Design Team Lead
\"In order to succeed, your desire for success should be greater than your fear of failure\"
InstallAware Software Corporation

alma88
Posts: 38
Joined: Wed Apr 18, 2007 5:38 am

Postby alma88 » Tue Aug 07, 2007 2:38 pm

Hi Panagioti,

Before installation both registry sections you mentioned are free of our assemblies. After installing our products their assemblies appear in HKEY_CURRENT_USER. After uninstalling our products their assemblies remain in HKEY_CURRENT_USER. They will be removed from HKEY_CURRENT_USER only if I manually remove them from the GAC. I have not been successful in convincing IA to do the work for me. I can reproduce this with every installation so it's not that it sometimes happens, it always happens. But, as I said, I might be doing something wrong myself. If you want to investigate this further then try this http://www.noemax.com/free_downloads/wcfx_trial.html.

Alexander

Gizm0
Posts: 339
Joined: Wed Nov 09, 2005 8:47 pm

Postby Gizm0 » Wed Aug 08, 2007 6:26 am

Alma88,

I told you about deleting the (Default) string of it, not entries inside the Registry Hive. On the top of the strings contained in the Hive there is a (Default) key. That's the one needed in both situations.

It's a bug from Windows Installer on .Net 2.0 assemblies and it's confirm by MS also.
Panagiotis Kefalidis

Software Design Team Lead

\"In order to succeed, your desire for success should be greater than your fear of failure\"

InstallAware Software Corporation

jperson
Posts: 4
Joined: Fri Mar 02, 2007 8:27 pm
Location: Lakewood, Colorado
Contact:

GAC Uninstallation Workaround for Frameworks 1.1, 2.0, 3.5

Postby jperson » Fri Jul 04, 2008 7:06 pm

We ended up having to use GACUTIL.EXE with the /ul switch to uninstall a support file named GAC.TXT which contained the assembly name and version of each assembly to remove.

You can get the direct path to GACUTIL.EXE on a target machine with this script:

Code: Select all

Comment: Get the path to the framework SDK for 1.1 and 2.0
Check Registry Key HKLM\\SOFTWARE\\Microsoft\\.NETFramework\\sdkInstallRootv1.1 into Framework11Folder
Check Registry Key HKLM\\SOFTWARE\\Microsoft\\.NETFramework\\sdkInstallRootv2.0 into Framework20Folder

Comment: Get the path to the GACUTIL executable
Set Variable GacUtility11 to $Framework11Folder$bin\\GACUTIL.EXE
Set Variable GacUtility20 to $Framework20Folder$bin\\GACUTIL.EXE


... then, a GAC.TXT support file added to the project. In this example three assemblies are listed:

Code: Select all

GeoFramework,Version=2.0.3600.0
GeoFramework.Gps,Version=2.3.3600.20
GeoFramework.Gis,Version=2.0.3600.1


... finally, a Run Program action is added to perform the removal, after the uninstallation is applied:

Code: Select all

Apply Uninstall (get result into variable SUCCESS)
if Variable SUCCESS not Equals CANCEL
  if Variable SUCCESS not Equals ERROR
    Run Program $GacUtility20$ /ul "$SUPPORTDIR$\\GAC.txt" (WAIT)
  end
end


... we've tested this with 2003, 2005 and 2008 and it's working. Some code was excluded which detects installed versions of Visual Studio, but this should help you all get GAC uninstalls working; best of luck!
Jon Person
GeoFrameworks
http://www.geoframeworks.com

jay@bplogix.com
Posts: 55
Joined: Wed Mar 11, 2009 5:26 pm
Contact:

Re: GAC Uninstallation Workaround for Frameworks 1.1, 2.0, 3.5

Postby jay@bplogix.com » Sun Mar 29, 2009 5:29 pm

jperson wrote:We ended up having to use GACUTIL.EXE with the /ul switch to uninstall a support file named GAC.TXT which contained the assembly name and version of each assembly to remove.


But GACUTIL.EXE is ONLY on machines that have the .NET SDK rather than the .NET runtime. Wouldn't this only work on "development" machines rather than end-user machines?

I am running into this problem right now. Since I cant shell out to GACUTIL.EXE, what is the appropriate way to remove the previous file that was installed to the GAC?

MichaelNesmith
Posts: 3452
Joined: Thu Dec 22, 2005 7:17 pm
Contact:

Postby MichaelNesmith » Mon Mar 30, 2009 9:34 am

InstallAware 8 does this natively for you.
Michael Nesmith

InstallAware

Home of The Next Generation MSI Installer

Get your free copy today - http://www.installaware.com/

stevenhope
Posts: 2
Joined: Wed Mar 04, 2009 2:43 pm

Re: Using Remove Assemblies

Postby stevenhope » Tue Jun 28, 2011 9:11 pm

I'm now using IA 11 and I can't get it to remove assemblies from the GAC. The install part works just fine.

I've added "Remove Unpinned Assemblies" directly after "Apply Uninstall" but still no joy.

The application help file doesn't say much, what am I missing?


Return to “Technical Support”

Who is online

Users browsing this forum: No registered users and 9 guests