How to Disable .Net Strong Name Verification for All .Net assembly in system by config .net framework or IIS or project's config?
-
4You don't need to blank out your file names. No one cares what the file is called and it makes it harder to help you out. – Scott Chamberlain Feb 13 '14 at 19:38
-
see this http://social.msdn.microsoft.com/Forums/vstudio/en-US/e730f235-7a53-4695-9f78-162fcc5cedbd/how-to-skip-strong-name-verification-in-vs-2010?forum=csharpgeneral – T.S. Feb 14 '14 at 02:49
4 Answers
Try add it in regestry:
OS x32:
[HKEY_LOCAL_MACHINE\SOFTWARE\Microsoft\StrongName\Verification\*,af24b530b87e22f1]
OS x64:
[HKEY_LOCAL_MACHINE\SOFTWARE\Microsoft\StrongName\Verification\*,af24b530b87e22f1]
[HKEY_LOCAL_MACHINE\SOFTWARE\Wow6432Node\Microsoft\StrongName\Verification\*,af24b530b87e22f1]
and add it to your Web.config:
<system.web>
<hostingEnvironment shadowCopyBinAssemblies="false" />
</system.web>

- 257
- 2
- 6
-
The `Web.config` change is an important step that the other answers I'd tried missed—thanks for calling it out. – Eric Eskildsen Jan 25 '19 at 20:02
To disable strong name validation for all assemblies on your machine you can run:
sn.exe -Vr *
from a Developer Command Prompt for VS201*

- 9,066
- 4
- 52
- 80
-
1Ensure that you are using the right version (64 bit or 32 bit) of sn.exe. If your assembly is 64 bit and you disable strong name validation (sn.exe -Vr *) with a 32 bit sn.exe, it doesn't work. You need to use 64 bit sn.exe only to work. – Krishna Prasad Yalavarthi Jul 11 '19 at 18:34
-
In order to avoid the confusion of 32 bit and 64 bit sn.exe, the best way to disable strong name verification is by directly modifying the registry by adding the below 2 entries. This makes your assembly to work for both 32 bit and 64 bit. [HKEY_LOCAL_MACHINE\SOFTWARE\Microsoft\StrongName\Verification\*,*] [HKEY_LOCAL_MACHINE\SOFTWARE\Wow6432Node\Microsoft\StrongName\Verification\*,*] – Krishna Prasad Yalavarthi Jul 11 '19 at 18:39
This is an exception I received:
Error Type: System.IO.FileLoadException
Error Message: Could not load file or assembly 'MyAssemblyName, Version=5.1.0.0, Culture=neutral, PublicKeyToken=30b439e30eee46b4' or one of its dependencies.
Strong name validation failed. (Exception from HRESULT: 0x8013141A)
This is a solution which worked for me to disable strong name validation for a particular assembly while testing it within totally signed service:
[HKEY_LOCAL_MACHINE\SOFTWARE\Microsoft\StrongName\Verification\MyAssemblyName,30b439e30eee46b4]
[HKEY_LOCAL_MACHINE\SOFTWARE\Wow6432Node\Microsoft\StrongName\Verification\MyAssemblyName,30b439e30eee46b4]
You have to create those new keys in the registry, keys have no values under them. You can copy these two lines into .reg file, change assembly name and its guid and double-click it to merge into the Registry.
Note: assembly name is your filename without .dll extension, exactly as it shows in the exception.
Then restart your app/service.
I think the answers above with * instead of assembly name should also work.

- 1,138
- 12
- 13
Below Entries will work:
[HKEY_LOCAL_MACHINE\SOFTWARE\Microsoft\StrongName\Verification\*,af24b530b87e22f1]
[HKEY_LOCAL_MACHINE\SOFTWARE\Wow6432Node\Microsoft\StrongName\Verification\*,af24b530b87e22f1]

- 14,195
- 22
- 56
- 52

- 41
- 2
-
2Please be explicit about what needs to be done when mentioning registry keys. Delete them? Add them? Change them? – JasonMArcher Aug 06 '14 at 17:38
-
2You want to add these keys to the registry. The easiest way is by running a powershell command: reg ADD "HKEY_LOCAL_MACHINE\SOFTWARE\Microsoft\StrongName\Verification\*,af24b530b87e22f1" – andrew Jan 20 '15 at 19:30
-