Strong name pairs February 2, 2008Posted by wesaday in Programming.
Tags: access denied, sn.exe, Vista
While working out some details, I came upon the need to generate a strong name pair using sn.exe. I couldn’t get it to work. I kept getting an error that said that there was an error generating the strong name pair mostly because “access denied”. WTF? I searched and searched. Found lots of people with the same problem but none of the solutions worked for me. Most of the “recent” posts were concerning Visual Studio 2005 and not having read permission on a directory. That bit of information didn’t do me any good since I am using VS 2008 on Vista and that directory doesn’t exist!
So, what I ended up doing was piecing the various bits together and working around this problem. The directory that needed to be modified was in a ProgramData directory that oddly enough doesn’t show up in explorer. I had to search for a “MachineKeys” directory. Even then I couldn’t do anything with it. Was still getting “Access denied” trying to change the permissions. I even tried using Icacls.exe to change it with no success. The real fix was to go into the properties and selected the Security tab and give yourself permissions. Explorer gave me an error when applying the settings but took them anyway.
After that, sn.exe worked fine for me.