Strong name validation failed. (Exception from HRESULT: 0x8013141A)
If you come across this error:
{"Could not load file or assembly 'TheAssemblyYouHaveReferenced' or one of its dependencies. Strong name validation failed. (Exception from HRESULT: 0x8013141A)":"TheAssemblyYouHaveReferenced'}
And you meet the following criteria
- You are referencing a Delay Signed Dll in your project
- Your OS is Win7 x64 or Vista x64
- You have the messages mentioned above.
You can create a "MyDisableRegistryFile.reg" file with something like below:
[HKEY_LOCAL_MACHINE\SOFTWARE\Microsoft\StrongName\Verification\*,58845dcd9090cc91]
[HKEY_LOCAL_MACHINE\SOFTWARE\Wow6432Node\Microsoft\StrongName\Verification\*,58845dcd9090cc91]
Where 58845dcd9090cc91(Fictious Value :-)) is the PublicKeyToken. If you create this file you can run it on each deployment or machine as part of your install process.
It should be pointed out that disabling SN verification isnt very secure but you may have your own reasons.
Also beaware your dll thats causing the error may have referenced other dlls that may have the same problem, so you may have to do this multiple times.
Quick fix use C:\Program Files\Microsoft SDKs\Windows\v6.0A\Bin\x64\sn.exe if on X64 and combine with -Vr <dllpath> if you want to disable verification too(-Vr is case sensitive). This is basically because sn.exe is 32bit and always returns success even in failure.
If you dont have the SDK installed for SN then get it here: https://www.microsoft.com/en-us/download/details.aspx?id=8279
This blog has some more information too -> https://blogs.msdn.com/b/shitals/archive/2008/05/01/8446582.aspx
Comments
Anonymous
October 01, 2012
The link to Connect above is dead now, was this bug archived? I cannot find it - the details might help resolve this issue (which I now have, too)Anonymous
October 01, 2012
The comment has been removedAnonymous
April 30, 2013
also you can use: sn.exe -Vr "dll path"Anonymous
October 08, 2015
Thanks. You saved the developer day!