I am using Visual Studio 2017 and am trying to create a .Net Standard 1.5 library and use it in a .Net 4.6.2 nUnit test project.
I am getting the following 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.
I have tried the following:
- Reference Std library as project reference. Error: gives me the previous error.
- Create a NuGet pkg for my Std library and reference that. Error: The type is System.String, expecting System.String. This is because System.Runtime ended up getting referenced by the project and it has definitions for all the standard types.
- Reference NuGet pkg NetStandard.Library. Error: give me the same error as # ("The type is System.String, expecting System.String"). NOTE: Before I did this, I cleared ALL NuGet packages from the project and then added just the nUnit and NetStandard.Library packages (which installed 45 other packages).
Is this a bug? Is there a work-around? Any help is appreciated.


This issue happens when you reference a .NET Standard project from a .NET 4.x project: none of the .NET Standard project's nuget package references are brought in as dependencies.
To fix this, you need to ensure your .NET 4.x csproj file is pointing to current build tools (at least 14):
The below should no longer be needed, it was fixed around VS 15.3:
There was a known bug in VS2017, specifically in NuGet 4.0.
To work around the bug, you'll need to open up the .csproj file for your .NET 4.x project and add this snippet:
NuGet 4.x brings with it the "package reference" -- no more packages.config -- but the old 4.x pipeline was not fully updated at the time of VS2017's launch. The above snippet seems to "wake up" the build system to correctly include package references from dependencies.