Granting permissions on the GAC

Normally you don't encounter permission errors when installing to the global assembly cache (GAC). Today I did, even though I was logged on as a member of the administrators group (not that being an administrator is a guarantee of much).

If you navigate using Windows Explorer to %windir%\assembly, what you see is the view displayed by the assembly cache viewer. If you go up a folder and right click the assembly folder and click properties you won't see the security tab you normally see. The assembly cache viewer (Shfusion.dll) is a Windows shell extension that affects how Windows Explorer lets you view the folder.

You have two options at this point -

1. Alter the behaviour of Windows Explorer with regard to the GAC. Hannes Pavelka gives a nice post on how to do this. 

2. Open a command window and use Cacls. Cacls allows you to both view and alter the permissions on any folder, and subfolders, for any account, including the GAC, as long as you are running it as an account that has permission to do so. Sounds like a russian doll of permissions, doesn't it?

I chose option 2 as I don't like altering the expected behaviour. This can cause confusion further down the line.

In order to get round the installation issue I ran the following at a command window -

CACLS %WINDIR%\assembly /e /t /p administrators:W

this gave members of the administrators builtin group write permissions on the GAC, and the subfolders, and sorted out the installation issues.