Migrating to version 3.5 of the AWS SDK for .NET
Version 3.5 of the AWS SDK for .NET further standardizes the .NET experience by transitioning support for all
non-Framework variations of the SDK to .NET Standard 2.0
This topic describes the changes in version 3.5 and possible work that you might need to do to migrate your environment or code from version 3.
What's changed for version 3.5
The following describes what has or hasn't changed in the AWS SDK for .NET version 3.5.
.NET Framework and .NET Core
Support for .NET Framework and .NET Core has not changed.
Xamarin
Xamarin projects (new and existing) must target .NET Standard 2.0. See .NET Standard
2.0 Support in Xamarin.Forms
Unity
Unity apps must target .NET Standard 2.0 or .NET 4.x profiles using Unity 2018.1 or later. For
more information, see .NET profile
support
Because Unity supports .NET Standard 2.0, the AWSSDK.Core package
of the SDK version 3.5 no longer has Unity-specific code, including some higher-level functionality.
To provide a better transition, all of the legacy Unity code is available for reference in the aws/aws-sdk-unity-net
Also see Special considerations for Unity support.
Universal Windows Platform (UWP)
Target your UWP application to version
16299 or later
Windows Phone and Silverlight
Version 3.5 of the AWS SDK for .NET does not support these platforms because Microsoft is no longer actively developing them. For more information, see the following:
Legacy portable class libraries (profile-based PCLs)
Consider retargeting your library to .NET Standard. For more information, see Comparison to Portable Class Libraries
Amazon Cognito Sync Manager and Amazon Mobile Analytics Manager
High-level abstractions that ease the use of Amazon Cognito Sync and Amazon Mobile Analytics are removed from version 3.5 of the AWS SDK for .NET. AWS AppSync is the preferred replacement for Amazon Cognito Sync. Amazon Pinpoint is the preferred replacement for Amazon Mobile Analytics.
If your code is affected by the lack of higher-level library code for AWS AppSync and Amazon Pinpoint, you
can record your interest in one or both of the following GitHub issues: https://github.com/aws/dotnet/issues/20
Migrating synchronous code
Version 3.5 of the AWS SDK for .NET supports both .NET Framework and .NET Standard (through .NET Core versions like .NET core 3.1, .NET 5, and so on). Variations of the SDK that comply with .NET Standard provide only asynchronous methods, so if you want to take advantage of .NET Standard, you must change synchronous code so that it runs asynchronously.
The following code snippets show how you might change synchronous code into asynchronous code. The code in these snippets is used to display the number of Amazon S3 buckets.
The original code calls ListBuckets.
private static ListBucketsResponse MyListBuckets() { var s3Client = new AmazonS3Client(); var response = s3Client.ListBuckets(); return response; } // From the calling function ListBucketsResponse response = MyListBuckets(); Console.WriteLine($"Number of buckets: {response.Buckets.Count}");
To use version 3.5 of the SDK, call ListBucketsAsync instead.
private static async Task<ListBucketsResponse> MyListBuckets() { var s3Client = new AmazonS3Client(); var response = await s3Client.ListBucketsAsync(); return response; } // From an **asynchronous** calling function ListBucketsResponse response = await MyListBuckets(); Console.WriteLine($"Number of buckets: {response.Buckets.Count}"); // OR From a **synchronous** calling function Task<ListBucketsResponse> response = MyListBuckets(); Console.WriteLine($"Number of buckets: {response.Result.Buckets.Count}");