.net: When i update the assembly version, it said: Could not load file or assembly. A strongly-named assembly is required

0

I have a assembly with C# code. And the version of this assembly is 1.0.0.0. This Assembly's information is serialized when i serialize the data of this assembly into binary. And then i update this assembly version into 4.0.0.0, **

and i remove the signature

**. When i de-serialize the data of assembly, an exception occur, which is "Could not load file or assembly '[AssemblyName], Version=1.0.0.0, Culture=neutral, PublicKeyToken=[TokenKey]' or one of its dependencies. A strongly-named assembly is required. (Exception from HRESULT: 0x80131044)".

How can i redirect my old version assembly to a new version assembly? Does configuration assembly binding work?

.net
serialization
version
signature
strongname
asked on Stack Overflow Feb 22, 2011 by yafeya • edited Feb 23, 2011 by yafeya

1 Answer

0

In your config, add the following block ,

    <runtime>
    <assemblyBinding xmlns="urn:schemas-microsoft-com:asm.v1">
        <dependentAssembly>
            <assemblyIdentity name="yourAssembly" publicKeyToken="PKTokenOfYourAssembly"/>
    <bindingRedirect oldVersion="1.0.0.0" newVersion="4.0.0.0"/>
  </dependentAssembly>
</assemblyBinding>

answered on Stack Overflow Feb 23, 2011 by Furqan Hameedi

User contributions licensed under CC BY-SA 3.0