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...
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):
<Project ToolsVersion="15.0">...
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:
<ItemGroup>
<PackageReference Include="Legacy2CPSWorkaround" Version="1.0.0">
<PrivateAssets>All</PrivateAssets>
</PackageReference>
</ItemGroup>
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.