如何使用Xamarin的Windows Box SDK Nuget包?

时间:2016-10-11 12:42:29

标签: xamarin nuget-package xamarin-studio

我正在尝试将Windows Box SDK(box.com)集成到Xamarin项目中。但是我经常在安装所需的nuget包时出错。 我设法安装了普通的Box.V2 SDK,但我仍然坚持使用Box.V2.JWT SDK。我收到了这个错误:

Attempting to gather dependency information for package 'Box.V2.JWTAuth.1.1.0' with respect to project 'Stuvia', targeting '.NETPortable,Version=v4.6,Profile=Profile44'
Attempting to resolve dependencies for package 'Box.V2.JWTAuth.1.1.0' with DependencyBehavior 'Lowest'
Resolving actions to install package 'Box.V2.JWTAuth.1.1.0'
Resolved actions to install package 'Box.V2.JWTAuth.1.1.0'
Removed package 'Microsoft.Bcl.1.1.8' from 'packages.config'
Added file 'packages.config' to project 'blabla'.
Successfully uninstalled 'Microsoft.Bcl.1.1.8' from Stuvia
Removed package 'Microsoft.Net.Http.2.2.20' from 'packages.config'
Added file 'packages.config' to project 'Stuvia'.
Removed reference 'System.Net.Http.Extensions' from project 'Stuvia'.
Removed reference 'System.Net.Http.Primitives' from project 'Stuvia'.
Successfully uninstalled 'Microsoft.Net.Http.2.2.20' from Stuvia
For adding package 'Microsoft.Bcl.1.1.10' to project 'Stuvia' that     targets 'portable46-net451+win81'.
For adding package 'Microsoft.Bcl.1.1.10' to project 'Stuvia' that     targets 'portable46-net451+win81'.
Adding package 'Microsoft.Bcl.1.1.10' to folder '/Users/HeldeR/Xamarin/Stuvia/packages'
Added package 'Microsoft.Bcl.1.1.10' to folder '/Users/HeldeR/Xamarin/Stuvia/packages'
Added package 'Microsoft.Bcl.1.1.10' to 'packages.config'
Added file 'packages.config' to project 'Stuvia'.
Successfully installed 'Microsoft.Bcl 1.1.10' to blabla
For adding package 'Microsoft.Net.Http.2.2.29' to project 'blabla' that targets 'portable46-net451+win81'.
For adding package 'Microsoft.Net.Http.2.2.29' to project 'blabla' that targets 'portable46-net451+win81'.
Adding package 'Microsoft.Net.Http.2.2.29' to folder '/Users/Me/Xamarin/blabla/packages'
Added package 'Microsoft.Net.Http.2.2.29' to folder '/Users/Me/Xamarin/blabla/packages'
Added reference 'System.Net.Http.Extensions' to project 'blabla'.
Added reference 'System.Net.Http.Primitives' to project 'blabla'.
Added package 'Microsoft.Net.Http.2.2.29' to 'packages.config'
Added file 'packages.config' to project 'blabla'.
Successfully installed 'Microsoft.Net.Http 2.2.29' to blabla
For adding package 'System.IdentityModel.Tokens.Jwt.4.0.2.206221351' to project 'blabla' that targets 'portable46-net451+win81'.
Install failed. Rolling back...
Package 'System.IdentityModel.Tokens.Jwt.4.0.2.206221351' does not exist in project 'blabla'
Removed package 'Microsoft.Net.Http.2.2.29 : Microsoft.Bcl [1.1.10, ), Microsoft.Bcl.Build [1.0.14, )' from 'packages.config'
Added file 'packages.config' to project 'blabla'.
Removed reference 'System.Net.Http.Extensions' from project 'blabla'.
Removed reference 'System.Net.Http.Primitives' from project 'blabla'.
Removed package 'Microsoft.Bcl.1.1.10 : Microsoft.Bcl.Build [1.0.14, )' from 'packages.config'
Added file 'packages.config' to project 'blabla'.
For adding package 'Microsoft.Net.Http.2.2.20' to project 'blabla' that targets 'portable46-net451+win81'.
For adding package 'Microsoft.Net.Http.2.2.20' to project 'blabla' that targets 'portable46-net451+win81'.
Package 'Microsoft.Net.Http.2.2.20' already exists in folder '/Users/Me/Xamarin/blabla/packages'
Added reference 'System.Net.Http.Extensions' to project 'blabla'.
Added reference 'System.Net.Http.Primitives' to project 'blabla'.
Added package 'Microsoft.Net.Http.2.2.20' to 'packages.config'
Added file 'packages.config' to project 'blabla'.
For adding package 'Microsoft.Bcl.1.1.8' to project 'blabla' that targets 'portable46-net451+win81'.
For adding package 'Microsoft.Bcl.1.1.8' to project 'blabla' that targets 'portable46-net451+win81'.
Package 'Microsoft.Bcl.1.1.8' already exists in folder '/Users/Me/Xamarin/blabla/packages'
Added package 'Microsoft.Bcl.1.1.8' to 'packages.config'
Added file 'packages.config' to project 'blabla'.
Package 'System.IdentityModel.Tokens.Jwt.4.0.2.206221351' does not exist in folder '/Users/Me/Xamarin/blabla/packages'
Removing package 'Microsoft.Net.Http.2.2.29 : Microsoft.Bcl [1.1.10, ), Microsoft.Bcl.Build [1.0.14, )' from folder '/Users/Me/Xamarin/blabla/packages'
Removed folder '/Users/Me/Xamarin/blabla/packages/Microsoft.Net.Http.2.2.29/lib/portable-net40+sl4+win8+wp71+wpa81'.
Removed folder '/Users/Me/Xamarin/blabla/packages/Microsoft.Net.Http.2.2.29/lib/portable-net45+win8+wpa81'.
Removed folder '/Users/Me/Xamarin/blabla/packages/Microsoft.Net.Http.2.2.29/lib/portable-net45+win8'.
Removed folder '/Users/Me/Xamarin/blabla/packages/Microsoft.Net.Http.2.2.29/lib/sl4-windowsphone71'.
Removed folder '/Users/Me/Xamarin/blabla/packages/Microsoft.Net.Http.2.2.29/lib/Xamarin.iOS10'.
Removed folder '/Users/Me/Xamarin/blabla/packages/Microsoft.Net.Http.2.2.29/lib/monoandroid'.
Removed folder '/Users/Me/Xamarin/blabla/packages/Microsoft.Net.Http.2.2.29/lib/monotouch'.
Removed folder '/Users/Me/Xamarin/blabla/packages/Microsoft.Net.Http.2.2.29/lib/net40'.
Removed folder '/Users/Me/Xamarin/blabla/packages/Microsoft.Net.Http.2.2.29/lib/net45'.
Removed folder '/Users/Me/Xamarin/blabla/packages/Microsoft.Net.Http.2.2.29/lib/wpa81'.
Removed folder '/Users/Me/Xamarin/blabla/packages/Microsoft.Net.Http.2.2.29/lib/win8'.
Removed folder '/Users/Me/Xamarin/blabla/packages/Microsoft.Net.Http.2.2.29/lib'.
Removed file 'Microsoft.Net.Http.2.2.29.nupkg' from folder '/Users/Me/Xamarin/blabla/packages/Microsoft.Net.Http.2.2.29'.
Removed folder '/Users/Me/Xamarin/blabla/packages/Microsoft.Net.Http.2.2.29'.
Removed package 'Microsoft.Net.Http.2.2.29 : Microsoft.Bcl [1.1.10, ), Microsoft.Bcl.Build [1.0.14, )' from folder '/Users/Me/Xamarin/blabla/packages'
Removing package 'Microsoft.Bcl.1.1.10 : Microsoft.Bcl.Build [1.0.14, )' from folder '/Users/Me/Xamarin/blabla/packages'
Removed folder '/Users/Me/Xamarin/blabla/packages/Microsoft.Bcl.1.1.10/lib/portable-net40+sl4+win8+wp71+wpa81'.
Removed folder '/Users/Me/Xamarin/blabla/packages/Microsoft.Bcl.1.1.10/lib/portable-net40+sl4+win8+wp8+wpa81'.
Removed folder '/Users/Me/Xamarin/blabla/packages/Microsoft.Bcl.1.1.10/lib/portable-net40+sl5+win8+wp8+wpa81'.
Removed folder '/Users/Me/Xamarin/blabla/packages/Microsoft.Bcl.1.1.10/lib/portable-net45+win8+wp8+wpa81'.
Removed folder '/Users/Me/Xamarin/blabla/packages/Microsoft.Bcl.1.1.10/lib/portable-net40+win8+wp8+wpa81'.
Removed folder '/Users/Me/Xamarin/blabla/packages/Microsoft.Bcl.1.1.10/lib/portable-net451+win81+wpa81'.
Removed folder '/Users/Me/Xamarin/blabla/packages/Microsoft.Bcl.1.1.10/lib/portable-net45+win8+wpa81'.
Removed folder '/Users/Me/Xamarin/blabla/packages/Microsoft.Bcl.1.1.10/lib/portable-win81+wp81+wpa81'.
Removed folder '/Users/Me/Xamarin/blabla/packages/Microsoft.Bcl.1.1.10/lib/portable-net40+sl4+win8'.
Removed folder '/Users/Me/Xamarin/blabla/packages/Microsoft.Bcl.1.1.10/lib/portable-net451+win81'.
Removed folder '/Users/Me/Xamarin/blabla/packages/Microsoft.Bcl.1.1.10/lib/portable-net40+win8'.
Removed folder '/Users/Me/Xamarin/blabla/packages/Microsoft.Bcl.1.1.10/lib/sl4-windowsphone71'.
Removed folder '/Users/Me/Xamarin/blabla/packages/Microsoft.Bcl.1.1.10/lib/Xamarin.iOS10'.
Removed folder '/Users/Me/Xamarin/blabla/packages/Microsoft.Bcl.1.1.10/lib/monoandroid'.
Removed folder '/Users/Me/Xamarin/blabla/packages/Microsoft.Bcl.1.1.10/lib/monotouch'.
Removed folder '/Users/Me/Xamarin/blabla/packages/Microsoft.Bcl.1.1.10/lib/net45'.
Removed folder '/Users/Me/Xamarin/blabla/packages/Microsoft.Bcl.1.1.10/lib/wpa81'.
Removed folder '/Users/Me/Xamarin/blabla/packages/Microsoft.Bcl.1.1.10/lib/net40'.
Removed folder '/Users/Me/Xamarin/blabla/packages/Microsoft.Bcl.1.1.10/lib/win8'.
Removed folder '/Users/Me/Xamarin/blabla/packages/Microsoft.Bcl.1.1.10/lib/wp8'.
Removed folder '/Users/Me/Xamarin/blabla/packages/Microsoft.Bcl.1.1.10/lib/sl4'.
Removed folder '/Users/Me/Xamarin/blabla/packages/Microsoft.Bcl.1.1.10/lib/sl5'.
Removed folder '/Users/Me/Xamarin/blabla/packages/Microsoft.Bcl.1.1.10/lib'.
Removed file 'Microsoft.Bcl.1.1.10.nupkg' from folder '/Users/Me/Xamarin/blabla/packages/Microsoft.Bcl.1.1.10'.
Removed folder '/Users/Me/Xamarin/blabla/packages/Microsoft.Bcl.1.1.10'.
Removed package 'Microsoft.Bcl.1.1.10 : Microsoft.Bcl.Build [1.0.14, )' from folder '/Users/Me/Xamarin/blabla/packages'
Could not install package 'System.IdentityModel.Tokens.Jwt 4.0.2.206221351'. You are trying to install this package into a project that targets '.NETPortable,Version=v4.6,Profile=Profile44', 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.

所以我安装普通Box SDK的做法是将我的便携式Xamarin项目的Xamarin配置文件更改为配置文件44,但我甚至不知道这是否可行,我无法做到JWT SDK也是如此。 任何帮助都非常感谢

1 个答案:

答案 0 :(得分:2)

移动平台不支持Box SDK。如果您在Github查看他们的回购,您将找到这些支持的平台:

  • .NET Framework 4.0.3及更高版本
  • 适用于Windows应用商店应用的.NET
  • Silverlight 4及更高版本
  • Windows Phone 7.5及更高版本

它不包括Xamarin.iOS或Xamarin.Android

另请参阅此问题:https://github.com/box/box-windows-sdk-v2/issues/114

  

问题实际上是jose-jwt库(它会失败的   好)。不幸的是,没有便携式兼容库   支持使用RSA私钥构造JWT断言。那是   实际上我们为JWT支持创建了一个单独的Nuget包   而不是仅将其添加到便携式Box.V2库。