1

When I get a System.IO.FileLoadException : Could not load file or assembly there are always 2 different Versions in the error message.

But the error text for both is the same:

System.IO.FileLoadException : Could not load file or assembly 'System.Runtime.InteropServices.RuntimeInformation, Version=4.0.2.0, Culture=neutral, PublicKeyToken=b03f5f7f11d50a3a' or one of its dependencies. The located assembly's manifest definition does not match the assembly reference. (Exception from HRESULT: 0x80131040)

...and:

System.IO.FileLoadException : Could not load file or assembly 'System.Runtime.InteropServices.RuntimeInformation, Version=4.0.0.0, Culture=neutral, PublicKeyToken=b03f5f7f11d50a3a' or one of its dependencies. The located assembly's manifest definition does not match the assembly reference. (Exception from HRESULT: 0x80131040)

It says that version 4.0.2.0 could not be loaded and it says also that version 4.0.0.0 could not be loaded.

What are these 2 versions exactly mean and which is the real version who could not be found?

fuz
  • 88,405
  • 25
  • 200
  • 352
kuppi
  • 53
  • 6
  • 2
    Possible duplicate of [Could not load file or assembly or one of its dependencies](https://stackoverflow.com/questions/4469929/could-not-load-file-or-assembly-or-one-of-its-dependencies) – Leo Chapiro Oct 08 '19 at 08:43
  • No, I asked what is the difference between these versions. – kuppi Oct 08 '19 at 08:50
  • Consider the scenario where I am using Newtonsoft.Json in my project. I am also referencing some library that is also using Newtonsoft.Json but with different version. Those are the two versions Shows in the log. – Vishnu K Oct 08 '19 at 09:05
  • I know this scenario: you have a web application targeting .NET Framework 4.6+, you have a NuGet package targeting .NET Standard, and you only get this error after deploying to the web server. Am I right? – CodeCaster Oct 08 '19 at 09:59
  • @CodeCaster I only get this error on the build server if I run the system test project. On my local machine, all is working fine. The system test starts a .NET 4.6.1 project which hosts an asp.net core 2.0 web API project. – kuppi Oct 08 '19 at 10:49
  • Yeah so that's a dependency hell introduced by the .NET Standard facade assemblies. I think installing .NET Core on the build server fixed it, but try searching for this error and now you'll know what to look for. – CodeCaster Oct 08 '19 at 11:01

0 Answers0