Curiosus.SFTP.SSH.NET 2.1.0

dotnet add package Curiosus.SFTP.SSH.NET --version 2.1.0
                    
NuGet\Install-Package Curiosus.SFTP.SSH.NET -Version 2.1.0
                    
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="Curiosus.SFTP.SSH.NET" Version="2.1.0" />
                    
For projects that support PackageReference, copy this XML node into the project file to reference the package.
<PackageVersion Include="Curiosus.SFTP.SSH.NET" Version="2.1.0" />
                    
Directory.Packages.props
<PackageReference Include="Curiosus.SFTP.SSH.NET" />
                    
Project file
For projects that support Central Package Management (CPM), copy this XML node into the solution Directory.Packages.props file to version the package.
paket add Curiosus.SFTP.SSH.NET --version 2.1.0
                    
#r "nuget: Curiosus.SFTP.SSH.NET, 2.1.0"
                    
#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.
#:package Curiosus.SFTP.SSH.NET@2.1.0
                    
#:package directive can be used in C# file-based apps starting in .NET 10 preview 4. Copy this into a .cs file before any lines of code to reference the package.
#addin nuget:?package=Curiosus.SFTP.SSH.NET&version=2.1.0
                    
Install as a Cake Addin
#tool nuget:?package=Curiosus.SFTP.SSH.NET&version=2.1.0
                    
Install as a Cake Tool

Curiosus.SFTP.SSH.NET

NuGet Downloads Coverage

Implementation of Curiosus.SFTP ISftpClient based on SSH.NET, with password or private key authentication and Polly retries.

Installation

dotnet add package Curiosus.SFTP.SSH.NET

Usage

Configure SftpClientOptions (either SshPassword or SshPrivateKeyPath is required):

Sftp:
  SshServer: sftp.example.com
  SshPort: 22
  SshLogin: user
  SshPrivateKeyPath: /secrets/id_rsa
  RetryCount: 3
  RetryTimeoutSec: 5
  CheckOnStart: true
using Curiosus.SFTP;
using Curiosus.SFTP.SSH.Net;
using Curiosus.Tools.TempFiles;

var sftpOptions = configuration.GetSection("Sftp").Get<SftpClientOptions>()!;

// SftpClient needs ITempFileStreamFactory from Curiosus.Tools
services.AddTempFileServices(new TempFileOptions());
services.AddSftpServices(sftpOptions);
using var client = sftpClientFactory.GetSftpClient();

await client.UploadFileToServerAsync(stream, "/upload", "data/report.csv");

await using var file = await client.DownloadFileFromServerAsync("/upload", "data/report.csv");

AddSftpServices registers the options, ISftpClientFactory and an app initializer (IAppInitializer, executed by Curiosus.Hosting on start) that checks the connection when CheckOnStart is true.

Notes:

  • SshPort has no default value, set it explicitly (usually 22).
  • If both a password and a private key are configured, password authentication is used.
  • Missing parent directories are created on upload. If a file with the same size already exists, the upload is skipped; if the size differs, it is replaced only when overwrite is true, otherwise an exception is thrown.
  • The namespace is Curiosus.SFTP.SSH.Net.

See also

Product Compatible and additional computed target framework versions.
.NET net9.0 is compatible.  net9.0-android was computed.  net9.0-browser was computed.  net9.0-ios was computed.  net9.0-maccatalyst was computed.  net9.0-macos was computed.  net9.0-tvos was computed.  net9.0-windows was computed.  net10.0 is compatible.  net10.0-android was computed.  net10.0-browser was computed.  net10.0-ios was computed.  net10.0-maccatalyst was computed.  net10.0-macos was computed.  net10.0-tvos was computed.  net10.0-windows was computed. 
Compatible target framework(s)
Included target framework(s) (in package)
Learn more about Target Frameworks and .NET Standard.

NuGet packages

This package is not used by any NuGet packages.

GitHub repositories

This package is not used by any popular GitHub repositories.

Version Downloads Last Updated
2.1.0 85 10/3/2026
2.0.0 90 9/28/2026