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

后端 未结 4 644
礼貌的吻别
礼貌的吻别 2021-02-07 14:37

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)

4条回答
  •  暖寄归人
    2021-02-07 15:01

    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.

提交回复
热议问题