I have an asp.net core 2.0 application that runs on full .net framework 4.6.1. It works fine locally but when I deploy it to Azure I receive the following error:
FileLoadException: Could not load file or assembly 'System.Runtime, Version=4.2.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)
Any idea how to fix that?
I am having this issue. What was your resolution?
Visual Studio 2017.3, Framework 461, published to Windows Server 2012R2 with Framework 4.7 and .NetCore 2.0.0 Hosting installed.
Found answer here:
https://stackoverflow.com/questions/45894659/fileloadexception-could-not-load-file-or-assembly-system-runtime-version-4-2-0
I started with a .Net Core app, switched to net461. Needed to delete all published artifacts and republish.
In my scenario with the same kind of project but targeting net471 with Visual studio 2017 15.5.3 over windows 10 Home throws the same error:
No se puede cargar el archivo o ensamblado 'System.Runtime, Version=4.2.0.0, Culture=neutral, PublicKeyToken=b03f5f7f11d50a3a' ni una de sus dependencias. El sistema no puede encontrar el archivo especificado.
@techaimail can you open a separate issue with steps to reproduce the error?
Anytime one switches frameworks or versions, bin and obj must be deleted (or full delete and rede ploy in production setting).
Most helpful comment
Found answer here:
https://stackoverflow.com/questions/45894659/fileloadexception-could-not-load-file-or-assembly-system-runtime-version-4-2-0
I started with a .Net Core app, switched to net461. Needed to delete all published artifacts and republish.