Wednesday, September 05, 2007

Removing Strong named assembly from GAC

I have created a .NET helper to provide me access to the BRE. In Vista, I stumbled upon this weird error. Everything has been working fine for the past month or so, now I am trying to deploy a newer version of this .NET helper, and I found that I could not un-deploy this assembly from the GAC.

After closing all programs, I still see this reference:

Looking at the Process Explorer I find that there is an instance of the MMC running. BTW, if you use regular Task Manager, you wont even see this instance. This instance has this command:

"C:\Program Files (x86)\Microsoft BizTalk Server 2006\BTSmmc.msc" "C:\Program Files (x86)\Microsoft BizTalk Server 2006\BTSmmc.msc" -32
Funny thing is that I can't kill this process in my explorer. When I try killing it from the Process Emplorer, it gives me this error:
Error opening process: The parameter is incorrect.
If I try to un-install it from the GAC directly (right-click on assembly), I get this error:
Assembly Cache Viewer = Uninstall failed
Access is denied: 'BRE.EDSHelper'

Running out of ideas, I decided to run the gacutil with elevated privileges in Vista.

Yeap, that did the trick... :D
gacutil /u BRE.EDSHelper
    1 C:\Windows\system32>gacutil /u bre.edshelper
    2 Microsoft (R) .NET Global Assembly Cache Utility.  Version 2.0.50727.42
    3 Copyright (c) Microsoft Corporation.  All rights reserved.
    6 Assembly: bre.edshelper, Version=, Culture=neutral, PublicKeyToken=47ef5031caf5d372, processorArchitecture=MSIL
    7 Uninstalled: bre.edshelper, Version=, Culture=neutral, PublicKeyToken=47ef5031caf5d372, processorArchitecture=MSIL
    8 Number of assemblies uninstalled = 1
    9 Number of failures = 0

Ahhh UAC is a beautiful and dangerous feature. And yet, I still keep it turn on (it rocks...;)


Anonymous said...

I am logged on as admin and yet I cannot remove the dll from the gac using the same as you,

gacutil /u myDll.dll

What did you do to get to uninstall, what do you by elevated priliges?


Arnulfo Wing said...

HI Yaz, in Vista, even though you are logged in as an administrator, you need to get elevated privileges. For that, right click on the CMD Shell and select Run as Administrator. That will run your command prompt with elevated privilege.

Hope this help.