Reputation: 311
Specific Error:
Assembly 'X' with identity 'X, Version=1.0.0.0, Culture=neutral, PublicKeyToken=null' uses 'System.Runtime.Extensions, Version=4.2.0.0, Culture=neutral, PublicKeyToken=b03f5f7f11d50a3a' which has a higher version than referenced assembly 'System.Runtime.Extensions' with identity 'System.Runtime.Extensions, Version=4.1.2.0, Culture=neutral, PublicKeyToken=b03f5f7f11d50a3a'
Error is thrown when invoking method of referenced assembly in dependant assembly.
Method (in referenced assembly) used to deserialize a Memory Stream and return the result:
public static object Deserialize(MemoryStream stream)
{
IFormatter formatter = new BinaryFormatter();
stream.Seek(0, SeekOrigin.Begin);
return formatter.Deserialize(stream);
}
Invocation (in the dependant assembly) throws the above error (CS1705)
To try and solve the problem, I added an App.Config file to the referenced assembly which is a Class Library [.net framework] and added this to the Configuration:
<runtime>
<assemblyBinding xmlns="urn:schemas-microsoft-com:asm.v1">
<dependentAssembly>
<assemblyIdentity name="System.Runtime.Extensions"
publicKeyToken="b03f5f7f11d50a3a"
culture="neutral" />
<bindingRedirect oldVersion="0.0.0.0-5.5.5.5"
newVersion="4.2.0.0"/>
</dependentAssembly>
</assemblyBinding>
</runtime>
Whichever newVersion I choose the error message remains unchanged. I can't wrap my head around what's going on.
Upvotes: 1
Views: 3885
Reputation: 311
The answer is that I'm simply an idiot. I had selected [.netCore] over [.netFramework] by mistake and just didn't realise it.
Upvotes: 3