Why would you still get "Strong name validation failed"?

There are not many web pages mentioning this so I would just post this so it comes up in search. Having personally spent 4 hours tracking this little thing down, I would want anyone else to go through same :).

So… if you are using delay signing, you will need to run the following command so you can still debug from Visual Studio.Net:

sn -Vr *,[public key token]

Apparently if you are using Vista 64-bit it just won’t work! You will still keep getting error something like,

Could not load file or assembly '[Your file], Version=2.0.0.0, Culture=neutral, PublicKeyToken=[public ket token]' or one of its dependencies. Strong name validation failed. (Exception from HRESULT: 0x8013141A)

You can try viewing Fusion log, cleaning solution, rebooting machine, watch FileMon, run Process Explorer, rebuild everything 10 times… but it just won’t work. Infect if you try removing signing and if your app is WPF 3.5 then you might even get even more weird errors like

Could not create an instance of type 'StaticExtension'

The solution is hidden in a one liner in Dan Wahlin’s blog:

If you’re running a 64-bit installation of Vista you’ll need to use the sn.exe located at C:\Program Files\Microsoft SDKs\Windows\v6.0A\Bin\x64\sn.exe

I’m pretty sure tons of developers adopting shiny 64-bit OS are/would run in to this. The root cause here is sn.exe designed for 32-bit doesn’t error out instead it happily lets you know that “Verification entry added for assembly ‘*,*’” successfully! It’s not! So I also filed a bug in out Connect web site. Please vote to make 64-bit world a better place!

Avatar
Shital Shah

A program trying to understand what it’s computing.

comments powered by Disqus