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

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

About this issue

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

Most upvoted comments

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.

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>

Any update on this, @mlorbetske and @sayedihashimi? My project didn’t compile because Stream was defined in two different assemblies. Googling that brought me nowhere. Microsoft.VisualStudio.Web.BrowserLink being the culprit didn’t occur to me at all…

Is there any reason not to release a patch version, as @dasMulli suggests?

@mlorbetske let’s try and chat today if possible

@mlorbetske since some more people are hitting this for various reasons, would it be possible to release a patch version (1.1.1) on nuget and future template updates to address the issue? (Latest user hitting this was @pauldotknopf via Slack)