Bryan Bryan - 1 month ago 26
ASP.NET (C#) Question

RavenDB Dependency Issue with .NET Core

I'm trying to create an embedded database in .NET Core using RavenDB. While the RavenDB.Client package is restoring without any issues, the RavenDB.Database package (which is required to make an embedded database) is not restoring properly even though it's only dependency is RavenDB.Client. I am receiving an error message which states that RavenDB.Database is not compatible with .netcoreapp1.0. Here's a picture of my package.json:

enter image description here

Answer

Package RavenDB.Database 3.5.0 supports: net45 (.NETFramework,Version=v4.5). Thus not supported on netcoreapp1.0. You can also download the https://www.nuget.org/api/v2/package/RavenDB.Database/3.5.0 package, extract and look at the lib folder to see what it supports.

Since RavenDB.Client supports netstandard1.3 it is supported on netcoreapp1.0 via the following analogy by David Fowler:

interface INetCoreApp10 : INetStandard15 //What we care about in this case
{

}

interface INetStandard10
{
    void Primitives();
    void Reflection();
    void Tasks();
    void Collections();
    void Linq();
}

interface INetStandard11 : INetStandard10
{
    void ConcurrentCollections();
    void InteropServices();
}

interface INetStandard12 : INetStandard11
{
    void ThreadingTimer();
}

interface INetStandard13 : INetStandard12 //NetStandard version this library supports
{
    void FileSystem();
    void Console();
    void ThreadPool();
    void Process();
    void Sockets();

    void AsyncLocal();
}

interface INetStandard14 : INetStandard13
{
    void IsolatedStorage();
}

interface INetStandard15 : INetStandard14
{
    void AssemblyLoadContext();
}

https://gist.github.com/davidfowl/8939f305567e1755412d6dc0b8baf1b7#file-_platform-cs-L127

TLDR; Use .NET 4.5 instead of .NET Core if you want to consume this library. Or wait until this library is ported to .NET Core.

To do so, change your frameworks in your project.json to the respective item:

"frameworks": {
  "net45": {
  }
}

Note: You will also need to remove the Microsoft.NETCore.App dependency as well.