Roy Osherove

View Original

Fix: Requested registry access is not allowed error when creating silverlight project in visual studio 2008

This is an issue that had me stumped for a while. I was getting a “Requested registry access is not allowed.” message from visual studio when trying to create a new silverlight application.

turns out the culprit is a few registry entries that somehow don’t have the correct permissions.

To fix this:

  • Download the “SubInACL” tool from Microsoft and install it
  • create a batch file in its install dir (C:\Program Files\Windows Resource Kits\Tools\)
  • the batch should contain:

subinacl /subkeyreg HKEY_CLASSES_ROOT\AgControl.AgControl /grant=administrators=f
subinacl /subkeyreg HKEY_CLASSES_ROOT\AgControl.AgControl /grant=users=f
subinacl /subkeyreg HKEY_CLASSES_ROOT\AgControl.AgControl /grant=system=f

subinacl /subkeyreg HKEY_CLASSES_ROOT\AgControl.AgControl\CLSID /grant=administrators=f
subinacl /subkeyreg HKEY_CLASSES_ROOT\AgControl.AgControl\CLSID /grant=users=f
subinacl /subkeyreg HKEY_CLASSES_ROOT\AgControl.AgControl\CLSID /grant=system=f

 

subinacl /subkeyreg HKEY_CLASSES_ROOT\AgControl.AgControl.2.0 /grant=administrators=f
subinacl /subkeyreg HKEY_CLASSES_ROOT\AgControl.AgControl.2.0 /grant=users=f
subinacl /subkeyreg HKEY_CLASSES_ROOT\AgControl.AgControl.2.0 /grant=system=f

subinacl /subkeyreg HKEY_CLASSES_ROOT\AgControl.AgControl.3.0 /grant=administrators=f
subinacl /subkeyreg HKEY_CLASSES_ROOT\AgControl.AgControl.3.0 /grant=users=f
subinacl /subkeyreg HKEY_CLASSES_ROOT\AgControl.AgControl.3.0 /grant=system=f

 

run the batch file from a command line as administrator, and that should fix the problem. This problem can also occur on other project types, so you may need to fix it by calling out to different registry keys. like this one for example.