Search code examples
nugetportable-class-libraryazure-cosmosdb

how to install Microsoft.Azure.DocumentDB.Core on portable library


I get error installing documentDB nuget package.

Could not install package 'Microsoft.Azure.DocumentDB.Core 1.2.1'. You are trying to install this package into a project that targets '.NETPortable,Version=v4.5,Profile=Profile7', but the package does not contain any assembly references or content files that are compatible with that framework.

Any ideas? thanks in advance.


Solution

  • The Core package actually targets NetStandard 1.6, not .Net Core specifically.

    NetStandard is a library that acts as API for different runtimes and it's much more powerfull than PCL because it's platform-agnostic:

    NetStandard compatibility chart

    This means that the DocumentDb.Core package can run on .Net Core 1.0, .Net Framework, Xamarin and UWP.

    If you are creating a PCL, I would recommend you to create a NetStandard library instead.

    It will let your library support a much wider universe of platforms and the great thing is that, if a new platform comes along that supports NetStandard 1.6 (for example), your library will work without needing to recompile or republish it.