Reputation: 85
I would like to use the DropBox SDK (https://github.com/dropbox/dropbox-sdk-dotnet ) in my c# project.
When I add using NuGet, I get the following error:
Package Dropbox.Api 4.3.0 is not compatible with netcoreapp1.1 (.NETCoreApp,Version=v1.1). Package Dropbox.Api 4.3.0 supports: - net45 (.NETFramework,Version=v4.5) - portable-dnxcore50+net45+win8+wp8+wpa81 (.NETPortable,Version=v0.0,Profile=net45+wp80+win8+wpa81+dnxcore50) - portable-net40+sl5+win8+wp8+wpa81 (.NETPortable,Version=v0.0,Profile=Profile328) One or more packages are incompatible with .NETCoreApp,Version=v1.1.
Lots of searching (including on Stack Overflow) points to needing to add an entry in my .csproj file. Indeed, the SDK says you need to add a reference. I've amended my file as follows but I still get the error.
<Project Sdk="Microsoft.NET.Sdk">
<PropertyGroup>
<OutputType>Exe</OutputType>
<TargetFramework>netcoreapp1.1</TargetFramework>
<PackageTargetFallback Condition="'$(TargetFramework)'=='Net45'">portable-net45win8+wp8+wpa81+dnxcore50</PackageTargetFallback>
</PropertyGroup>
</Project>
Any ideas much appreciated.
Upvotes: 0
Views: 279
Reputation: 100581
The portable version of the Dropbox package is supported on .NET Core, your csproj file however contains a Condition
that does not enable the package target fallback. you can change your csproj to this for the snipped you posted:
<PropertyGroup>
<OutputType>Exe</OutputType>
<TargetFramework>netcoreapp1.1</TargetFramework>
<PackageTargetFallback>$(PackageTargetFallback);dnxcore50</PackageTargetFallback>
</PropertyGroup>
The value for PackageTargetFallback
can also be portable-net45+win8
like explain on their README file on GitHub. For the upcoming .NET Core 2.0, this fallback should no longer be needed.
Upvotes: 1