Including legacy library in .NET Core 2 app

0

I'm trying to build a .net core C# app that requires a reference to an older library. Everything compiles and builds fine, but when the app attempts to execute any code from this library, it throws an exception:

System.IO.FileLoadException: 'Could not load file or assembly 'mscorlib, Version=5.3.0.620, Culture=neutral, PublicKeyToken=b77a5c561934e089'. The located assembly's manifest definition does not match the assembly reference. (Exception from HRESULT: 0x80131040)'

The 5.3.0.620 is the version of the DLL that I'm including, but it shouldn't be the version of mscorlib required. When I include the reference in a .NET 4.6.1 app, I don't get this error.

Is there any way to force the library to be happy with the included version of mscorlib (or any other workaround)?

Edit: This is not a duplicate of this question. That person is trying to reference 4.0.0.0. I already have that reference in place. My problem is that in a .NET Core 2 app, the library I'm loading tries to reference an incorrect (non-existent) version of MSCORLIB for reasons that I don't comprehend. When I load the library in a .NET 4.6.1 app, the library behaves correctly and loads the 4.0.0.0 version.

c#
asked on Stack Overflow May 15, 2018 by Blake Fitzgerald • edited May 15, 2018 by Blake Fitzgerald

0 Answers

Nobody has answered this question yet.


User contributions licensed under CC BY-SA 3.0