gpt4 book ai didi

c# - AWS dll 供 c# 项目引用

转载 作者:太空宇宙 更新时间:2023-11-03 21:07:48 27 4
gpt4 key购买 nike

我已经安装了 AWS .NET SDK通过 MSI 安装程序。我想使用这段代码:

static IAmazonS3 client;
client = new AmazonS3Client(Amazon.RegionEndpoint.USEast1);
PutObjectRequest request = new PutObjectRequest()
{
BucketName = bucketName,
Key = keyName,
FilePath = filePath
};
PutObjectResponse response2 = client.PutObject(request);

如果我手动浏览到一个 dll 以添加对项目的引用,我可以看到以下库 - 我应该使用哪些库才能实现上述操作?我需要的唯一功能是能够将对象放入 S3。

enter image description here


注意

我不想使用 AWS 模板之一创建 AWS 项目 - 我只需要将上述功能添加到现有项目中

最佳答案

来自文档,Getting Started with the AWS SDK for .NET — Developer Guide :

You can also base your application on one of the standard Visual Studio project templates. Just add a reference to the AWS .NET library (AWSSDK.dll), which is located in the past-releases folder of the the SDK installation directory.

因此您只需要从 past-releases 目录中引用 AWSSDK.dll。

根据您的屏幕截图,您找错了地方,即 Toolkit for Visual Studio 目录之一。

对于早期版本的 SDK(版本 1 和 2),您可以在 C:\Program Files (x86)\AWS SDK for .NET\past-releases\Version-1\..\Version-2 分别。版本 3(默认情况下)安装在 C:\Program Files (x86)\AWS SDK for .NET\bin 中。

因此:对于 V1 和 V2,您只需引用适当的 AWSSDK.dll。对于 V3,您需要引用 AWSSDK.Core.dll 和您要使用的服务的程序集,在您的情况下为 AWSSDK.S3.dll

也就是说,using the NuGet package manager这样做更容易。

关于c# - AWS dll 供 c# 项目引用,我们在Stack Overflow上找到一个类似的问题: https://stackoverflow.com/questions/40041056/

27 4 0
Copyright 2021 - 2024 cfsdn All Rights Reserved 蜀ICP备2022000587号
广告合作:1813099741@qq.com 6ren.com