Announcements
Known issues updated. Learn more

Dropbox API 2 supports .Net Core 1.1?

Helpful | Level 6

Hi,

 

I have an ASP.Net Core 1.1.1 app that uses the DropBox API. When starting Visual Studio 2017 I get an error message:

 

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=Profile32smiling face with sunglasses

 

However, this message disappears when I compile and things seem to run just fine, except when I do Unit tests (XUnit). Then I get this error :

 

System.AggregateException : One or more errors occurred. (Could not load file or assembly 'Dropbox.Api, Version=4.0.0.0, Culture=neutral, PublicKeyToken=310f0e82fbb45d01'. The system cannot find the file specified.)

---- System.IO.FileNotFoundException : Could not load file or assembly 'Dropbox.Api, Version=4.0.0.0, Culture=neutral, PublicKeyToken=310f0e82fbb45d01'. The system cannot find the file specified.

   at System.Threading.Tasks.Task.ThrowIfExceptional(Boolean includeTaskCanceledExceptions)

   at System.Threading.Tasks.Task`1.GetResultCore(Boolean waitCompletionNotification)

   at xUnitTest.test.FeedsAdminControllerShould.ReturnViewAndProperModelForPostEdit() ....[rest removed]

 

-What is going on here? How come the app works fine, but fails when testing?

-Is there an older cached version hanging around or something?

-Should Dropbox.Api 4.3.0 be compatible with .net core? If not, which version of Dropbox API should I use?

-Has this anything to do with the phasing out of version 1 of the API?

 

Any and all comments are appreciated,

Oskar

 

1 Accepted solution

Accepted Solutions

Re: Dropbox API 2 supports .Net Core 1.1?

Dropboxer

The SDK supports .Net Core 1.1. You just need to make sure you have

  • <PackageTargetFallback>portable-net45+win8</PackageTargetFallback> added to both main and test projects.
  • Microsoft.NETCore.Portable.Compatibility nuget package installed for main project.
  • Visual studio doesn't return any error when the build process tries to restore nuget packages. Sometimes the restore may fail due to error like "Unable to resolve ...  for '.NETCoreApp,Version=v1.1'". If that happens you may need to re-open visual studio / re-add the project. Then a clean and re-build should remove the error.

If the issue still persist please let us know.

 

Thanks,

Qiming

 

Reply
Loading...
6 Replies

Re: Dropbox API 2 supports .Net Core 1.1?

Dropboxer
This isn't related to API v1 (the .NET SDK only uses API v2 to begin with). The API .NET SDK should work with .NET Standard 1.1+, though it may require some extra configuration.

If you are using project.json, you need to add portable-net45+win8 to imports under you frameworks section. If you are using .csproj file, you need to add <PackageTargetFallback>portable-net45+win8</PackageTargetFallback> element to your project.
Reply
Loading...

Re: Dropbox API 2 supports .Net Core 1.1?

Helpful | Level 6

Hi Greg,

 

Thanks for your quick response.

 

I have already this in my .csproj -file.

<PackageTargetFallback>$(PackageTargetFallback);dotnet5.6;portable-net45+win8</PackageTargetFallback>

It comes as a default.

 

Adding or replacing the element you sent doesn't seem to make any difference

 

Oskar

 

 

Reply
Loading...

Re: Dropbox API 2 supports .Net Core 1.1?

Dropboxer

The SDK supports .Net Core 1.1. You just need to make sure you have

  • <PackageTargetFallback>portable-net45+win8</PackageTargetFallback> added to both main and test projects.
  • Microsoft.NETCore.Portable.Compatibility nuget package installed for main project.
  • Visual studio doesn't return any error when the build process tries to restore nuget packages. Sometimes the restore may fail due to error like "Unable to resolve ...  for '.NETCoreApp,Version=v1.1'". If that happens you may need to re-open visual studio / re-add the project. Then a clean and re-build should remove the error.

If the issue still persist please let us know.

 

Thanks,

Qiming

 

Reply
Loading...

Re: Dropbox API 2 supports .Net Core 1.1?

Helpful | Level 6

Hi Qiming,

 

Thanks for your reply.

 

I was missing the PackageTargetFallback -tag in the test project. That solved it. Thanks a million.

 

I do not have the Microsoft.NETCore.Portable.Compatibility -package installed. Things seem to work without it. Under what circumstances would I need to install this package?

 

All the best,

Oskar

 

Reply
Loading...

Re: Dropbox API 2 supports .Net Core 1.1?

Dropboxer

Your code may not be able to compile if you call async method in the SDK without Microsoft.NETCore.Portable.Compatibility installed. If your code already compiles and works fine then you don't have to install it.

Reply
Loading...

Re: Dropbox API 2 supports .Net Core 1.1?

New member | Level 2
قناة شليلة

وضيفة التكامل
Reply
Loading...
API Support

Have a question? Our Dropbox Community is here to help you find an answer!
You won’t have to wait too long for a reply, but why not learn more about the Community while you’re here.

Not the right discussion for you? Find out what else our Community has to say about API Support.

Or, search our Help Center for even more.

Who's talking
Top contributors to this post