Saturday, 2 June 2012

Problems deleting assemblies from the GAC

I have occasional need to do this and, when I try and delete an item from the GAC using the Windows Explorer view (by navigating to %windir%\assembly) I always get ‘Access Denied’ errors. So to save me the age it always seems to take me to find how to overcome this each time I need to, I’ll write it here.

This requires a local security policy to be altered. Run the local security policy MMC (just start typing ‘local’ in the Windows Start menu search box) and navigate down through: Security Settings, Local Policies, Security Options and change the ‘User Account Control: Run all administrators in Admin Approval Mode’ entry to Disabled.

Now restart Windows, delete any GAC assemblies you like, reload the local security policy MMC so you can revert the policy to Enabled (and then restart again) and you’re done.

An alternative ‘sledgehammer vs. nut’ approach is, apparently, to disable User Account Control.