Two machines. Both with .NET 3.5 and the VS 2008 VC++ SP1 redistributables
A single exe which uses two signed DLLs, one in C++/CLI and one in C#
The exe loads and runs fine on one machine.
On the other, I get "Strong Name Validation Failed" on the C++ executable (HRESULT 0x8013141A)
Any ideas?
Open the command prompt as administrator and enter the following command:
Pay attention that the argument are case sensitive. Source with more details: http://blogs.msdn.com/b/keithmg/archive/2012/03/20/strong-name-validation-failed-exception-from-hresult-0x8013141a.aspx
In my case, I had the same issue with
Visual Studio 2015
and I already had signed the assembly.I fixed it by this way: Right click on the project which causes the issue -> "Properties" -> "Build" -> Change the value of the "Platform target" field.
I had to change it from
Any CPU
tox86
but I guess that in function of the project and the library which is failing, you should change its value tox64
.Is the one the code runs on a "development" machine where you might have run "sn.exe -Vr AssemblyName.dll" at some stage which would allow you to use a delay signed assembly as if it were fully signed. When you transfer the delay signed assembly to another machine and run it, it will fail strong name validation because it is not fully signed.
If someone can't find 64-bit version of
sn.exe
, check here:C:\Program Files (x86)\Microsoft SDKs\Windows\v10.0A\bin\NETFX 4.7.2 Tools\x64\sn.exe
The SN.EXE is Missing in Newer versions of Visual Studio. In Visual studio 2012, we must use "Developer command prompt for Visual studio 2012". Then Run the command "sn".
Syntax: sn -Vr *,2d58152b8e842be2
where "2d58152b8e842be2" is the public key token shown in the Error message. Somehow this alone did not solve my problem.
I encountered this today and stumbled across http://timgeerts.blogspot.co.uk/2009/08/strong-name-validation-failed.html, which seems to be the solution.
Option 1) Turn off code coverage (in VS 2010, go to Test Settings -› Data and Diagnostics -› Untick the "Enabled" box next to Code Coverage).
Option 2) Add the signing key file to the code coverage configuration (in VS 2010, go to Test Settings -› Data and Diagnostics -› select Code Coverage and click on "Configure" at the top. This corresponds to the "keyFile" attribute for the CodeCoverage tag in the .testsettings file.)
In VS 2012, code coverage is enabled by default. It can be disabled through a .runsettings file with an appropriate exclusion. See http://msdn.microsoft.com/en-us/library/jj159530.aspx for more information and a sample file. For option 2, although there doesn't seem to be an explicit setting available in the .runsettings file, the right thing seems to happen automatically with regard to signing (YMMV). However, if you're referencing a VS 2010 .testsettings file then it will need editing as above.