"Failed to open registry key -- Unable to format error message 00000005" Error from SN.EXE


When running the Strong Name Utility tool with the .NET Framework 4 from a non-administrative command prompt with the -Vr, command line option to register an assembly for verification skipping:

sn -Vr ClassLibrary1.dll

 you may see the error:

Failed to open registry key -- Unable to format error message 00000005

This error can also be displayed when using the -Vu and -Vx options to unregister assembles for verification skipping.


Verification skipping will create a registry key which requires permissions elevation of the command prompt. The correct error message when running sn -Vr from a non-elevated command prompt is:

Failed to open registry key -- access is denied

The incorrect error message in the Symptoms section is caused by a bug in the Strong Name Utility which comes with the .NET Framework 4.


You should register your assembly for verification skipping by running the Strong Name Utility from an elevated or administrator command prompt:

From the Start Menu, select All Programs. Open the Microsoft Visual Studio 2010 folder and then the Visual Studio Tools folder. Right-click the Visual Studio Command Prompt (2010) and click the Run as administrator context menu.

Alternatively, you can right-click any Command Prompt icon (All Programs/Accessories) and choose Run as administrator. Navigate to the Visual Studio 2010 SDK tools directory (e.g. C:\Program Files\Microsoft SDKs\Windows\v7.0A\Bin) and run SN.EXE.