Minio 5.0.2

There is a newer version of this package available.
See the version list below for details.

Requires NuGet 2.14 or higher.

dotnet add package Minio --version 5.0.2                
NuGet\Install-Package Minio -Version 5.0.2                
This command is intended to be used within the Package Manager Console in Visual Studio, as it uses the NuGet module's version of Install-Package.
<PackageReference Include="Minio" Version="5.0.2" />                
For projects that support PackageReference, copy this XML node into the project file to reference the package.
paket add Minio --version 5.0.2                
#r "nuget: Minio, 5.0.2"                
#r directive can be used in F# Interactive and Polyglot Notebooks. Copy this into the interactive tool or source code of the script to reference the package.
// Install Minio as a Cake Addin
#addin nuget:?package=Minio&version=5.0.2

// Install Minio as a Cake Tool
#tool nuget:?package=Minio&version=5.0.2                

MinIO Client SDK for .NET Slack

MinIO Client SDK provides higher level APIs for MinIO and Amazon S3 compatible cloud storage services.For a complete list of APIs and examples, please take a look at the Dotnet Client API Reference.This document assumes that you have a working VisualStudio development environment.

Install from NuGet

To install MinIO .NET package, run the following command in Nuget Package Manager Console.

PM> Install-Package Minio

MinIO Client Example

To connect to an Amazon S3 compatible cloud storage service, you need the following information

Variable name Description
endpoint <Domain-name> or <ip:port> of your object storage
accessKey User ID that uniquely identifies your account
secretKey Password to your account
secure boolean value to enable/disable HTTPS support (default=true)

The following examples uses a freely hosted public MinIO service "play.min.io" for development purposes.

using Minio;

var endpoint = "play.min.io";
var accessKey = "Q3AM3UQ867trueSPQQA43P2F";
var secretKey = "zuf+tfteSlswRu7BJ86wtrueekitnifILbZam1KYY3TG";
var secure = true;
// Initialize the client with access credentials.
private static MinioClient minio = new MinioClient()
                                    .WithEndpoint(endpoint)
                                    .WithCredentials(accessKey, secretKey)
                                    .WithSSL(secure)
                                    .Build();

// Create an async task for listing buckets.
var getListBucketsTask = await minio.ListBucketsAsync().ConfigureAwait(false);

// Iterate over the list of buckets.
foreach (var bucket in getListBucketsTask.Result.Buckets)
{
    Console.WriteLine(bucket.Name + " " + bucket.CreationDateDateTime);
}

Complete File Uploader Example

This example program connects to an object storage server, creates a bucket and uploads a file to the bucket. To run the following example, click on [Link] and start the project

using System;
using Minio;
using Minio.Exceptions;
using Minio.DataModel;
using System.Threading.Tasks;

namespace FileUploader
{
    class FileUpload
    {
        static void Main(string[] args)
        {
            var endpoint  = "play.min.io";
            var accessKey = "Q3AM3UQ867SPQQA43P2F";
            var secretKey = "zuf+tfteSlswRu7BJ86wekitnifILbZam1KYY3TG";
            try
            {
                var minio = new MinioClient()
                                    .WithEndpoint(endpoint)
                                    .WithCredentials(accessKey, secretKey)
                                    .WithSSL()
                                    .Build();
                FileUpload.Run(minio).Wait();
            }
            catch (Exception ex)
            {
                Console.WriteLine(ex.Message);
            }
            Console.ReadLine();
        }

        // File uploader task.
        private async static Task Run(MinioClient minio)
        {
            var bucketName = "mymusic";
            var location   = "us-east-1";
            var objectName = "golden-oldies.zip";
            var filePath = "C:\\Users\\username\\Downloads\\golden_oldies.mp3";
            var contentType = "application/zip";

            try
            {
                // Make a bucket on the server, if not already present.
                var beArgs = new BucketExistsArgs()
                    .WithBucket(bucketName);
                bool found = await minio.BucketExistsAsync(beArgs).ConfigureAwait(false);
                if (!found)
                {
                    var mbArgs = new MakeBucketArgs()
                        .WithBucket(bucketName);
                    await minio.MakeBucketAsync(mbArgs).ConfigureAwait(false);
                }
                // Upload a file to bucket.
                var putObjectArgs = new PutObjectArgs()
                    .WithBucket(bucketName)
                    .WithObject(objectName)
                    .WithFileName(filePath)
                    .WithContentType(contentType);
                await minio.PutObjectAsync(putObjectArgs).ConfigureAwait(false);
                Console.WriteLine("Successfully uploaded " + objectName );
            }
            catch (MinioException e)
            {
                Console.WriteLine("File Upload Error: {0}", e.Message);
            }
        }
    }
}

Running MinIO Client Examples

On Windows

  • Clone this repository and open the Minio.Sln in Visual Studio 2017.

  • Enter your credentials and bucket name, object name etc. in Minio.Examples/Program.cs

  • Uncomment the example test cases such as below in Program.cs to run an example.

  //Cases.MakeBucket.Run(minioClient, bucketName).Wait();
  • Run the Minio.Client.Examples project from Visual Studio

On Linux

Setting .NET SDK on Linux (Ubuntu 22.04)

<blockquote> NOTE: minio-dotnet requires .NET 6.x SDK to build on Linux. </blockquote>

wget https://packages.microsoft.com/config/ubuntu/22.04/packages-microsoft-prod.deb -O packages-microsoft-prod.deb
sudo dpkg -i packages-microsoft-prod.deb
rm packages-microsoft-prod.deb
sudo apt-get update; \
  sudo apt-get install -y apt-transport-https && \
  sudo apt-get update && \
  sudo apt-get install -y dotnet-sdk-6.0
Running Minio.Examples
  • Clone this project.
$ git clone https://github.com/minio/minio-dotnet && cd minio-dotnet
  • Enter your credentials and bucket name, object name etc. in Minio.Examples/Program.cs Uncomment the example test cases such as below in Program.cs to run an example.
  //Cases.MakeBucket.Run(minioClient, bucketName).Wait();
dotnet build --configuration Release --no-restore
dotnet pack ./Minio/Minio.csproj --no-build --configuration Release --output ./artifacts
dotnet test ./Minio.Tests/Minio.Tests.csproj
Bucket Operations
Bucket policy Operations
Bucket notification Operations
File Object Operations
Object Operations
Presigned Operations
Client Custom Settings

Explore Further

Product Compatible and additional computed target framework versions.
.NET net5.0 was computed.  net5.0-windows was computed.  net6.0 is compatible.  net6.0-android was computed.  net6.0-ios was computed.  net6.0-maccatalyst was computed.  net6.0-macos was computed.  net6.0-tvos was computed.  net6.0-windows was computed.  net7.0 is compatible.  net7.0-android was computed.  net7.0-ios was computed.  net7.0-maccatalyst was computed.  net7.0-macos was computed.  net7.0-tvos was computed.  net7.0-windows was computed.  net8.0 was computed.  net8.0-android was computed.  net8.0-browser was computed.  net8.0-ios was computed.  net8.0-maccatalyst was computed.  net8.0-macos was computed.  net8.0-tvos was computed.  net8.0-windows was computed. 
.NET Core netcoreapp2.0 was computed.  netcoreapp2.1 was computed.  netcoreapp2.2 was computed.  netcoreapp3.0 was computed.  netcoreapp3.1 was computed. 
.NET Standard netstandard2.0 is compatible.  netstandard2.1 was computed. 
.NET Framework net461 was computed.  net462 was computed.  net463 was computed.  net47 was computed.  net471 was computed.  net472 was computed.  net48 was computed.  net481 was computed. 
MonoAndroid monoandroid was computed. 
MonoMac monomac was computed. 
MonoTouch monotouch was computed. 
Tizen tizen40 was computed.  tizen60 was computed. 
Xamarin.iOS xamarinios was computed. 
Xamarin.Mac xamarinmac was computed. 
Xamarin.TVOS xamarintvos was computed. 
Xamarin.WatchOS xamarinwatchos was computed. 
Compatible target framework(s)
Included target framework(s) (in package)
Learn more about Target Frameworks and .NET Standard.

NuGet packages (172)

Showing the top 5 NuGet packages that depend on Minio:

Package Downloads
Minio.AspNetCore

ASP.NET extensions for MinIO .NET SDK.

OnceMi.AspNetCore.OSS

ASP.NET Core对象储存扩展包,支持Minio自建对象储存、阿里云OSS、腾讯云COS、七牛云Kodo、华为云OBS、百度云BOS、天翼云OOS经典版。

Volo.Abp.BlobStoring.Minio

Package Description

learun.utils

力软开发框架util通用方法

Microi.net

开源低代码平台-Microi吾码,官网:https://microi.net

GitHub repositories (12)

Showing the top 5 popular GitHub repositories that depend on Minio:

Repository Stars
abpframework/abp
Open-source web application framework for ASP.NET Core! Offers an opinionated architecture to build enterprise software solutions with best practices on top of the .NET. Provides the fundamental infrastructure, cross-cutting-concern implementations, startup templates, application modules, UI themes, tooling and documentation.
duplicati/duplicati
Store securely encrypted backups in the cloud!
dotnetcore/Util
Util是一个.Net平台下的应用框架,旨在提升中小团队的开发能力,由工具类、分层架构基类、Ui组件,配套代码生成模板,权限等组成。
iamoldli/NetModular
NetModular 是基于.Net Core 和 Vue.js 的业务模块化以及前后端分离的快速开发框架
blogifierdotnet/Blogifier
Blogifier is an open-source publishing platform Written in ASP.NET and Blazor WebAssembly. With Blogifier make a personal blog or a website.
Version Downloads Last updated
6.0.4 5,161 12/20/2024
6.0.3 515,368 6/26/2024
6.0.2 664,537 2/11/2024
6.0.1 628,432 11/10/2023
6.0.0 271,965 9/30/2023
5.0.2 1,564 10/19/2024
5.0.0 1,275,922 5/4/2023
4.0.7 800,878 1/7/2023
4.0.6 580,029 10/29/2022
4.0.5 802,208 7/25/2022
4.0.4 225,726 6/11/2022
4.0.3 164,892 5/16/2022
4.0.2 123,320 4/9/2022
4.0.1 88,763 3/15/2022
4.0.0 626,013 2/28/2022
3.1.13 5,210,992 5/28/2020
3.1.12 110,766 5/1/2020
3.1.11 132,530 4/14/2020
3.1.10 102,095 3/14/2020
3.1.9 201,251 1/8/2020
3.1.8 35,531 12/13/2019
3.1.7 183,961 10/30/2019
3.1.6 58,324 10/11/2019
3.1.5 418,009 9/25/2019
3.1.4 65,824 9/6/2019
3.1.3 3,505 9/5/2019
3.1.2 3,958 9/4/2019
3.1.1 41,101 8/9/2019
3.1.0 2,390 8/7/2019
3.0.12 45,733 7/3/2019
3.0.11 20,144 6/12/2019
3.0.10 26,337 5/8/2019
3.0.9 11,799 4/17/2019
3.0.8 36,112 3/20/2019
3.0.7 6,169 3/13/2019
3.0.6 3,293 3/6/2019
3.0.5 7,488 2/27/2019
3.0.4 12,176 2/13/2019
3.0.3 3,988 1/30/2019
3.0.2 12,208 1/18/2019
3.0.1 2,705 1/16/2019
3.0.0 10,713 1/10/2019
2.0.7 63,971 12/19/2018
2.0.6 16,533 11/6/2018
2.0.5 139,878 10/5/2018
2.0.4 4,381 9/22/2018
2.0.3 2,858 9/19/2018
2.0.2 5,587 9/15/2018
2.0.1 13,348 8/14/2018
2.0.0 5,515 7/24/2018
1.1.1 75,198 4/6/2018
1.1.0 3,158 3/20/2018
1.0.7 3,397 1/12/2018
1.0.6 2,406 12/27/2017
1.0.5 2,752 12/23/2017
1.0.4 3,104 12/5/2017
1.0.2 12,785 8/29/2017
1.0.1 2,488 8/7/2017
1.0.0 3,142 5/17/2017
0.2.1 12,355 11/25/2015
0.2.0 9,915 8/22/2015