I have a web app initially targeting 4.6.1. This web app references a class library; in turn, this references a Net Standard 1.6 class library.
Adding the reference to the Net Standard library was the latest change, and appears to have caused it to break: the web app was working fine until the Net Standard library was introduced; at which point, I started getting the error:
Could not load file or assembly 'System.Runtime, Version=4.1.0.0, Culture=neutral, PublicKeyToken=b03f5f7f11d50a3a' or one of its dependencies. The system cannot find the file specified.
System.Runtime
is included as a NuGet package in the web app.
It may not be relevant, but when I look in the packages directory; I see System.Runtime.4.3.0\lib has net45
and net462
directories, but not 4.6.1 or 4.7 (see below for why I would expect this).
Some things that I've tried that haven't worked:
There's enough recent stuff on the web that makes me think I'm not the only person to experience this; although I haven't found any explanation as to what might be the cause. Can anyone offer an explanation as to what might be causing this, or any diagnostic steps that I can use?
After a long converting process, which I described here I have the experience: you have to install the NuGet package NETStandard.Library also in your main project (in your webapp .net 4.6.1). It will install a plenty of packages.
I use NETStandard.Library version 1.6.1.
If you use System.Runtime.Serialization in your netstandard code, you have to install System.Runtime.Serialization.Primitives and System.Runtime.Serialization.Xml or .Json in the main project, too.
And also all other references of the netstandard project should be referenced in the main project, too.
I had a similar problem and I solved it by removing the System.Runtime reference from the project and install it via Nuget (Net Standard compatible). It wasn't the only package that had problems (other example, System.Net.Http). Also, if you have multiple projects in your solution, you should install Net Standard on every one of them.
If you love us? You can donate to us via Paypal or buy me a coffee so we can maintain and grow! Thank you!
Donate Us With