question-mark
Stuck on an issue?

Lightrun Answers was designed to reduce the constant googling that comes with debugging 3rd party libraries. It collects links to all the places you might be looking at while hunting down a tough bug.

And, if you’re still stuck at the end, we’re happy to hop on a call to see how we can help out.

"Could not load file or assembly 'System.Runtime, Version=4.2.0.0'"

See original GitHub issue

Steps to reproduce

  • dotnet new -t web1.1
  • dotnet restore
  • dotnet run

Expected behavior

Application started. Press Ctrl+C to shut down.

Actual behavior

Unhandled Exception: System.IO.FileLoadException: Could not load file or assembly ‘System.Runtime, Version=4.2.0.0, Culture=neutral, PublicKeyToken=b03f5f7f11d50a3a’. The located assembly’s manifest definition does not match the assembly reference. (Exception from HRESULT: 0x80131040)

Environment data

dotnet --info output:

.NET Command Line Tools (1.0.0-rc3-004530)

Product Information:
 Version:            1.0.0-rc3-004530
 Commit SHA-1 hash:  10b642bc12

Runtime Environment:
 OS Name:     ubuntu
 OS Version:  14.04
 OS Platform: Linux
 RID:         ubuntu.14.04-x64
 Base Path:   /usr/share/dotnet/sdk/1.0.0-rc3-004530

Issue Analytics

  • State:closed
  • Created 7 years ago
  • Reactions:6
  • Comments:21 (10 by maintainers)

github_iconTop GitHub Comments

3reactions
mikebrindcommented, Mar 2, 2017

I resolved this by navigating to C:\Users\...\AppData\Roaming\.Nuget\packages and deleting the existing microsoft.visualstudio.web.browserlink folder. Then run dotnet restore on the project folder.

2reactions
dasMullicommented, Jan 31, 2017

The issue here is that the version included in the CLI’s offline package cache of Microsoft.VisualStudio.Web.BrowserLink version 1.1.0 seems to be broken. If do rm -r ~/.nuget/packages/microsoft.visualstudio.web.browserlink and then run dotnet restore and dotnet run again, no issues occur.

I suppose a nightly dev-feed version of that package made it into the CLI? This repros in 1.0.0-rc3-004530 but the version included in 1.0.0-rc4-004711 is fine. Is this fixed permanently? If so, it should probably be marked as an RC3 known issue. cc @piotrpMSFT @livarcocc

MacBook-Pro:tmp martin$ cat ~/.nuget/packages/microsoft.visualstudio.web.browserlink/1.1.0/microsoft.visualstudio.web.browserlink.nuspec 
<?xml version="1.0" encoding="utf-8"?>
<package xmlns="http://schemas.microsoft.com/packaging/2012/06/nuspec.xsd">
  <metadata>
    <id>Microsoft.VisualStudio.Web.BrowserLink</id>
    <version>1.1.0</version>
    <authors>Microsoft</authors>
    <owners>Microsoft</owners>
    <requireLicenseAcceptance>false</requireLicenseAcceptance>
    <description>A middleware that supports creating a communication channel between the development environment and one or more web browsers.</description>
    <tags></tags>
    <serviceable>true</serviceable>
    <dependencies>
      <group targetFramework=".NETFramework4.5.1">
        <dependency id="Microsoft.AspNetCore.Hosting.Abstractions" version="[1.1.0, )" />
        <dependency id="Microsoft.AspNetCore.Http.Abstractions" version="[1.1.0, )" />
        <dependency id="Microsoft.AspNetCore.Http.Extensions" version="[1.1.0, )" />
        <dependency id="Microsoft.Extensions.FileProviders.Physical" version="[1.1.0, )" />
      </group>
      <group targetFramework=".NETStandard1.5">
        <dependency id="System.Net.Sockets" version="[4.4.0-beta-24903-02, )" />
        <dependency id="System.Net.Primitives" version="[4.4.0-beta-24903-02, )" />
        <dependency id="System.IO.MemoryMappedFiles" version="[4.4.0-beta-24903-02, )" />
        <dependency id="System.Diagnostics.Tools" version="[4.4.0-beta-24903-02, )" />
        <dependency id="Microsoft.AspNetCore.Hosting.Abstractions" version="[1.1.0, )" />
        <dependency id="Microsoft.AspNetCore.Http.Abstractions" version="[1.1.0, )" />
        <dependency id="Microsoft.AspNetCore.Http.Extensions" version="[1.1.0, )" />
        <dependency id="Microsoft.Extensions.FileProviders.Physical" version="[1.1.0, )" />
      </group>
    </dependencies>
  </metadata>
</package>
Read more comments on GitHub >

github_iconTop Results From Across the Web

Could not load file or assembly 'System.Runtime, Version= ...
Go to your project folder. · Delete the bin file inside your project folder. · Remove all added references. · Load your project...
Read more >
Cannot load file or assembly 'System.Runtime'
When I try to run the application, I get this error: Could not load file or assembly 'System.Runtime, Version=4.0.0.0, Culture=neutral, ...
Read more >
NET Core: Could not load file or assembly 'System. ...
This seems very similar to Issue 150 and Issue 139 but I could not solve the problem by removing dependencies to my shared...
Read more >
Could not load file or assembly 'System.Runtime, Version= ...
Hi, I read other post about this error but I m not sure that the other have this issue only when the project...
Read more >
Could not load file or assembly System.Runtime in NET4x
I blamed visual studio IDE and NuGet package manager for not being able to bring a simple DLL into bin folder. In one...
Read more >

github_iconTop Related Medium Post

No results found

github_iconTop Related StackOverflow Question

No results found

github_iconTroubleshoot Live Code

Lightrun enables developers to add logs, metrics and snapshots to live code - no restarts or redeploys required.
Start Free

github_iconTop Related Reddit Thread

No results found

github_iconTop Related Hackernoon Post

No results found

github_iconTop Related Tweet

No results found

github_iconTop Related Dev.to Post

No results found

github_iconTop Related Hashnode Post

No results found