How To: Turn off Strong Name Validation

Syed Aslam Basha here. I am a tester on the Information Security Tools team.

In one of my  testing projects I faced the issue of “strong name validation failed” for an assembly and had to figure out a way to turn off strong name validation so that I could carryout testing on the given assembly while dev marched on towards a final build.

The actual error is

“Unhandled exception: System.IO.FileLoadException: Could not load file or assembly ‘application name, version=, culture=neutral, publickeytoken=b03f5f7f11d50a3a’ or one of its dependencies. Strong name validation failed.<Exception from HRESULT: 0x8013141A>”

Steps to Turn Off Strong Name Validation:

Launch visual studio command prompt in admin mode and run the following command

sn –Vr *,b03f5f7f11d50a3a

-Vr <assembly> [<userlist>] [<infile>]

Register <assembly> for verification skipping (with an optional, comma separated list of usernames for which this will take effect and an optional test public key in <infile>).
<assembly>    can be specified as * to indicate all assemblies or *,<public key token> to indicate that all assemblies with the given public key token. Public key tokens should be specified as a string of hex digits.

Similarly you can remove verification skipping entries,

sn –Vu *,b03f5f7f11d50a3a
-Vu <assembly>
   Unregister <assembly> for verification skipping. The same rules for <assembly> naming are followed as for -Vr.

sn -Vx
   Remove all verification skipping entries.

- Syed