Be Kind To New Users
Be Kind To New Users

Reputation: 10063

Installing Dropbox API for C#

I am following the instructions here for installing the Dropbox API for C#.

https://www.dropbox.com/developers/documentation/dotnet#install

Those instructions are to run Install-Package Dropbox.Api in powershell.

I get the following error:

PS > Install-Package Dropbox.Api
Install-Package : No match was found for the specified search criteria and package name 'Dropbox.Api'. Try
Get-PackageSource to see all available registered package sources.
At line:1 char:1
+ Install-Package Dropbox.Api
+ ~~~~~~~~~~~~~~~~~~~~~~~~~~~
    + CategoryInfo          : ObjectNotFound: (Microsoft.Power....InstallPackage:InstallPackage) [Install-Package], Exception
    + FullyQualifiedErrorId : NoMatchFoundForCriteria,Microsoft.PowerShell.PackageManagement.Cmdlets.InstallPackage

Doing a bit of googling there are suggestions for the general case of this error message to specify a PackageSource. But I can not find the correct package source for dropbox.

My sources of packages like this:

PS > Get-PackageSource

Name                             ProviderName     IsTrusted  Location
----                             ------------     ---------  --------
PSGallery                        PowerShellGet    False      https://www.powershellgallery.com/api/v2/
nuget.org                        NuGet            False      https://api.nuget.org/v3/index.json

How can I get the Dropbox API installed for C# for Visual Studio 2017?

[EDIT] I tried:

PS > Install-Package Get-PackageSource -Version 4.3.0
Install-Package : A parameter cannot be found that matches parameter name 'Version'.
At line:1 char:35
+ Install-Package Get-PackageSource -Version 4.3.0
+                                   ~~~~~~~~
    + CategoryInfo          : InvalidArgument: (:) [Install-Package], ParameterBindingException
    + FullyQualifiedErrorId : NamedParameterNotFound,Microsoft.PowerShell.PackageManagement.Cmdlets.InstallPackage

[EDIT] I tried Tools -> NuGet Package Manager -> Manage packages and could find the package there.

[EDIT] I tried installing Dropbox.Api using Tools -> NuGet Package Manager -> Manage Packages and get: Package restore failed. Rolling back package changes. There was a message that flashed before the error, but it was just the location of the project in my directory structure.

[EDIT] Following @smarx suggestion of running from package manager console rather than powershell:

Restoring packages for C:\Users\Michael Potter\Documents\Visual Studio 2017\Projects\ConsoleApp1\ConsoleApp1\ConsoleApp1.csproj...
Install-Package : 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)
At line:1 char:1
+ Install-Package Dropbox.Api
+ ~~~~~~~~~~~~~~~~~~~~~~~~~~~
    + CategoryInfo          : NotSpecified: (:) [Install-Package], Exception
    + FullyQualifiedErrorId : NuGetCmdletUnhandledException,NuGet.PackageManagement.PowerShellCmdlets.InstallPackageCommand

Install-Package : Package restore failed. Rolling back package changes for 'ConsoleApp1'.
At line:1 char:1
+ Install-Package Dropbox.Api
+ ~~~~~~~~~~~~~~~~~~~~~~~~~~~
    + CategoryInfo          : NotSpecified: (:) [Install-Package], Exception
    + FullyQualifiedErrorId : NuGetCmdletUnhandledException,NuGet.PackageManagement.PowerShellCmdlets.InstallPackageCommand

Time Elapsed: 00:00:00.9676774
PM> 

So that is very good progress as now we get some kind of error message.

Upvotes: 2

Views: 1140

Answers (2)

Be Kind To New Users
Be Kind To New Users

Reputation: 10063

I posted two questions thinking they were different, but they turned out to have the same solution:

Package restore failed. Rolling back package changes for 'ConsoleApp1' while installing new package

I am closing this question as a duplicate.

Upvotes: 0

user94559
user94559

Reputation: 60143

Those instructions are to run Install-Package Dropbox.Api in powershell.

The instructions actually say to run that command in the Package Manager Console. Open the Package Manager Console inside Visual Studio, and make sure that your prompt looks like PM >, not PS >.

Upvotes: 1

Related Questions