Aspnetcore: FileLoadException: Could not load file or assembly System.Runtime, Version=4.2.0.0

Created on 25 Aug 2017  路  5Comments  路  Source: dotnet/aspnetcore

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?

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.

All 5 comments

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).

Was this page helpful?
0 / 5 - 0 ratings

Related issues

fayezmm picture fayezmm  路  3Comments

FourLeafClover picture FourLeafClover  路  3Comments

markrendle picture markrendle  路  3Comments

UweKeim picture UweKeim  路  3Comments

aurokk picture aurokk  路  3Comments