How to Disable Strong Name Verification for All .Net assembly?

帅比萌擦擦* 提交于 2019-12-03 17:09:28

问题


How to Disable .Net Strong Name Verification for All .Net assembly in system by config .net framework or IIS or project's config?

(click for larger image)


回答1:


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>



回答2:


To disable strong name validation for all assemblies on your machine you can run:

sn.exe -Vr *

from a Developer Command Prompt for VS201*




回答3:


Below Entries will work:

[HKEY_LOCAL_MACHINE\SOFTWARE\Microsoft\StrongName\Verification\*,af24b530b87e22f1]
[HKEY_LOCAL_MACHINE\SOFTWARE\Wow6432Node\Microsoft\StrongName\Verification\*,af24b530b87e22f1]



回答4:


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.



来源:https://stackoverflow.com/questions/21763822/how-to-disable-strong-name-verification-for-all-net-assembly

易学教程内所有资源均来自网络或用户发布的内容,如有违反法律规定的内容欢迎反馈
该文章没有解决你所遇到的问题?点击提问,说说你的问题,让更多的人一起探讨吧!