# Alibaba Cloud OSS SDK for C#
Alibaba Cloud Object Storage Service (OSS) is a cloud storage service provided by Alibaba Cloud, featuring massive capacity, security, a low cost, and high reliability.
.NET 2.0
or above.Visual Studio 2010
or above.Mono 3.12
or above.TOOLS
> NuGet Package Manager
> Manage NuGet Packages for Solution
.aliyun.oss.sdk
in the search box and click Search, find Aliyun.OSS.SDK
in the search results, select the latest version, and click Install. After installation, the SDK is added to the project.git clone https://github.com/aliyun/aliyun-oss-csharp-sdk.git
.Install via Project Introduction
.Solution Explorer
, select your project, right click Project Name, select Add Reference
from the pop-up menu.
In the Reference Manager
dialog box, click Browse, find the directory that the SDK is unzipped to, select the Aliyun.OSS.dll file in the bin directory, and click OK.Solution Explorer
and select Add
> Existing Projects
from the pop-up menu.aliyun-oss-sdk.csproj
file, and click Open.Add Reference
. In the Reference Manager
dialog box, click the Projects
tab, select the aliyun-oss-sdk project, and click OK.Xamarin
, create a project or open an existing project, and select Tools
> Add NuGet Packages
.aliyun.oss.sdk
in the search box and click Search, find 'Aliyun.OSS.SDK' in the search results, select the latest version, and click Add Package
. After installation, the SDK is added to the project.git clone https://github.com/aliyun/aliyun-oss-csharp-sdk.git
.Aliyun.OSS.dll
file. Then install the SDK through DLL reference.Solution
, select your project, right click Project Name, select Reference
' > Edit References
from the pop-up menu.
In the Edit References
dialog box, click .Net Assembly
> Browse
. Find the directory that the SDK is unzipped to, select the Aliyun.OSS.dll
file in the bin directory, and click Open. OssClient client = new OssClient(endpoint, accessKeyId, accessKeySecret);
var buckets = client.ListBuckets();
foreach (var bucket in buckets)
{
Console.WriteLine(bucket.Name + ", " + bucket.Location + ", " + bucket.Owner);
}
OssClient client = new OssClient(endpoint, accessKeyId, accessKeySecret);
client.CreateBucket(bucketName);
OssClient client = new OssClient(endpoint, accessKeyId, accessKeySecret);
client.DeleteBucket(bucketName);
OssClient client = new OssClient(endpoint, accessKeyId, accessKeySecret);
client.PutObject(bucketName, key, filePathToUpload);
OssClient client = new OssClient(endpoint, accessKeyId, accessKeySecret);
var object = ossClient.GetObject(bucketName, key);
OssClient client = new OssClient(endpoint, accessKeyId, accessKeySecret);
var listResult = client.ListObjects(bucketName);
foreach (var summary in listResult.ObjectSummaries)
{
Console.WriteLine(summary.Key);
}
OssClient client = new OssClient(endpoint, accessKeyId, accessKeySecret);
client.DeleteObject(bucketName, key)