[SOLVED] Can't Install Couchbase.Lite 2.0.0-db023 with NuGet

I am not able to install the db023 release.
I have .Net Framework 4.6.1 installed.
I am using Visual Studio Community 2017.
I had previously been using db022.
The Couchbase.Lite.Support.NetDesktop v2.0.0-db023 package installs fine.
I created a brand new project, and installing db023 fails with the error below, db022 installs fine.
Is there something I’m missing?

Could not install package ‘Couchbase.Lite 2.0.0-db023’. You are trying to install this package into a project that targets ‘.NETFramework,Version=v4.6.1’, but the package does not contain any assembly references or content files that are compatible with that framework. For more information, contact the package author.

I think you must be missing something too, but I’m not sure what it is. I did the same steps as you but the install succeeded.

Restoring packages for D:\Development\Net461Test\Net461Test\Net461Test.csproj…
Restoring packages for D:\Development\Net461Test\Net461Test\Net461Test.csproj…
Committing restore…
Generating MSBuild file D:\Development\Net461Test\Net461Test\obj\Net461Test.csproj.nuget.g.props.
Generating MSBuild file D:\Development\Net461Test\Net461Test\obj\Net461Test.csproj.nuget.g.targets.
Writing lock file to disk. Path: D:\Development\Net461Test\Net461Test\obj\project.assets.json
Restore completed in 31.92 ms for D:\Development\Net461Test\Net461Test\Net461Test.csproj.
Successfully installed ‘Couchbase.Lite 2.0.0-db023’ to Net461Test
Successfully installed ‘Couchbase.Lite.Support.NetDesktop 2.0.0-db023’ to Net461Test
Successfully installed ‘Newtonsoft.Json 9.0.1’ to Net461Test
Successfully installed ‘SimpleInjector 4.0.12’ to Net461Test
Executing nuget actions took 285.12 ms

Perhaps you need to install the .NET Core 2.0 SDK (Just a guess?). DB022 was .NET Standard 1.4 and DB023 is .NET Standard 2.0. .NET Framework 4.6.1 supports both.

I did not have .NET Core 2.0 SDK installed.
I installed it, but I get the same error.
I am unable to use db023.

I think you need to contact someone on Microsoft’s forums because I am not sure what is going on there. I created a new .NET Framework 4.6.1 console app (choosing packagereference instead of packages.config for Nuget management) and installed the package without issue.

EDIT One thing you might try is deleting the package from the local nuget packages folder in case somehow it got messed up during download.

Well, the error message literally says to contact the package author. I’m willing to bet that Microsoft will just bounce me back to here.

I just created a new .Net Framework 4.6.1 console app, and I selected PackageReference as the default management format.
Couchbase.Lite.Support.NetDesktop installs fine.
But attempting to install Couchbase.Lite now gives this error:

Package restore failed. Rolling back package changes for ‘CouchbaseTest3’.

I tried clearing the NuGet cache, but that didn’t help.

Yes, you did contact the package author, and the package author doesn’t understand the problem :blush:. Are you on an old version of VS 2017? I am running the latest (15.6.2) and I have no issues doing exactly what you described. The error message says “This library doesn’t support .NET Framework 4.6.1” but it does so the error message is wrong. I don’t know why it thinks that the library doesn’t but the following information might be relevant:

  • DB023 moved to .NET Standard 2.0 (DB022 was .NET Standard 1.4)
  • .NET Standard 2.0 was originally designed to be implemented in .NET Framework 4.7
  • Microsoft inserted some hacks to backport things and make it run on .NET Framework 4.6.1+
  • .NET Framework 4.6.1 supports .NET Standard 2.0 (reference) as long as the .NET Core 2.0 SDK is installed

So what it looks like is your install thinks “.NET Standard 2.0 != .NET Framework 4.6.1”, which is wrong.

1 Like

I got it working. Sorry to put you on the spot, but thanks for the quick response and help.
I was on VS 2017 v15.2 - upgrading to 15.6 solved the issue for me.

You are exactly right about my install thinking “.NET Standard 2.0 != .NET Framework 4.6.1”

I found this issue in the NuGet project:
Misleading error when .NET Standard version is not known to be compatible with target framework

There is a comment on that page that applies here:
“What we are seeing right now is customers complaining to package authors that their libraries targeting .NET Standard 2.0 are not supported in .NET Framework 4.6.1 and up, when the reality is that they are.”

Hopefully this will help someone else as the solution is not obvious.

1 Like

Glad you figured it out! I will follow the advice the the linked thread of adding MinClientVersion to the project.