Abhi Singh
Abhi Singh

Reputation: 361

The type 'AWSCredentials' exist in both AWSSDK.Core And AWSSDK error

Hello I am working on uploading video on AWS using Asp .net core. For that, I am trying to get access key and other credentials using the code below.

var profileCrendial= new CredentialProfileStoreChain();
AWSCredentials awsCredentials;
using (var user = new AmazonSecurityTokenServiceClient(awsCredentials))
{
}

and

using (var SClient = new AmazonSecurityTokenServiceClient(awsCredentials))
{
 var req = new AssumeRoleRequest
 {
 }
}

For that I have installed AWSSDK v2.3.55.2 and AWSSDK.S3 v3.3.111.28 from NuGet package. I am getting type 'AWSCredentials' exist in both AWSSDK.Core error on the following line.

AWSCredentials awsCredentials;

How can I rectify this error?

Upvotes: 2

Views: 1503

Answers (1)

Philip Pittle
Philip Pittle

Reputation: 12295

Remove the dependency on AWSSDK and instead use AWSSDK.SecurityToken

The AWSSDK package has been replaced with a newer set of packages. From the package description:

This is the previous version 2 generation of the AWS SDK for .NET. The new version 3 of the AWS SDK for .NET uses separate packages for each service. For example Amazon S3 is in the AWSSDK.S3 package, Amazon SQS is in AWSSDK.SQS and Amazon DynamnoDB is in AWSSDK.DynamoDBv2.

So you'll need to pull in the packages for the specific services you'd like to use. In this case AWSSDK.SecurityToken and if you'd like to write to S3 then also AWSSDK.S3

Upvotes: 1

Related Questions