I have a project for Business Logic and DAL, call this project A. This library has .NET Standard 2.0 as the target framework. I'm referencing a NuGet Package, RavenDB.Client 3.5.4 which is using the library/dll in the netstandard1.3 folder of the NuGet package.
I have an ASP.NET Web API app that has a target framework of .NET Framework 4.7.1, call this project B (not using .Net Core 2 because there are some references to legacy code that does not work with .Net Core).
I have a ASP.NET Core app as well, call this project C with a target framework of .NET Core 2.0.
Both project B and C reference project A.
Project C can reference project A and the RaveDB.Client NuGet Package without an issue, because it uses the library/dll in the netstandard1.3 folder as well. When making calls to the BL or DAL in package A from C there are no issues.
Project B can reference project A, but the referencing RavenDB.Client NuGet Package references the package/dll in the net45 folder. I get this error:
The type 'IDocumentStore' is defined in an assembly that is not referenced.You must add a reference to assembly 'Raven.Client.Lightweight, Version=3.5.4.0, Culture=neutral, PublicKeyToken=null
Which at first is misleading because clearly the issues is with Target Framework. I have a reference to Raven.Client.Raven.Client.Lightweight Version 3.5.4.0. But I'm passing an object (IDcoumentStore) built from net45 library to netstandard1.3 library.
My question, because .NET Framework 4.7.1 can use .NET Standard library, how do I force a project in VS2017 targeting .NET Framework 4.7.1 to use a .NET Standard library in a NuGet package? I tried changing targetFramework="net471" to targetFramework="netstandard1.3" that does not work seems as if VS or NuGet reverts back.
My only solution, which is a pain on many levels, is to strip out the net45 library from the Nuget package and roll my own with only the .Netstandard library.
packages.config
? Do you try to use package reference instead? – Lex Li