无法在PCL项目中使用AWS

时间:2015-11-17 19:03:06

标签: c# amazon-web-services amazon-s3 xamarin portable-class-library

在我的PCL项目中,我添加了以下两个NuGet包:

  • AWSSDK.S3
  • private AmazonS3Client _client; private TransferUtility _trans; public MyClass() { AmazonS3Config config = new AmazonS3Config (); config.ServiceURL = "s3-eu-west-1.amazonaws.com"; config.UseHttp = true; config.RegionEndpoint = RegionEndpoint.EUWest1; _client = new AmazonS3Client (_access, _secret, config); _trans = new TransferUtility (_client); } public async void UploadFile(string path, string key) { TransferUtilityUploadRequest up = new TransferUtilityUploadRequest(); up.BucketName = "mybucket"; up.FilePath = path; up.Key = key; up.UploadProgressEvent += up_UploadProgressEvent; await _trans.UploadAsync(up); }

像这样使用它们

NUnit

现在,当我尝试使用at PCLStorage.FileSystem.get_Current() at Amazon.S3.Transfer.TransferUtility.validate(TransferUtilityUploadRequest request) in d:\Jenkins\jobs\v3-stage-release\workspace\AWSDotNetPublic\sdk\src\Services\S3\Custom\Transfer\TransferUtility.cs:line 367 at Amazon.S3.Transfer.TransferUtility.GetUploadCommand(TransferUtilityUploadRequest request, SemaphoreSlim asyncThrottler) in d:\Jenkins\jobs\v3-stage-release\workspace\AWSDotNetPublic\sdk\src\Services\S3\Custom\Transfer\_async\TransferUtility.async.cs:line 281 at Amazon.S3.Transfer.TransferUtility.UploadAsync(TransferUtilityUploadRequest request, CancellationToken cancellationToken) in d:\Jenkins\jobs\v3-stage-release\workspace\AWSDotNetPublic\sdk\src\Services\S3\Custom\Transfer\_async\TransferUtility.async.cs:line 184 测试此方法时,我收到以下错误

  

此功能未在便携版本中实现   部件。您应该参考您的PCLStorage NuGet包   主要应用项目,以参考特定于平台   实施

StackTrace正在

viewControllers

1 个答案:

答案 0 :(得分:0)

您还应该在特定于平台的项目中添加Core和S3软件包。

如果您使用的是Xamarin,则必须在PCL以及Android或iOS项目中添加软件包。