diff --git a/src/Renci.SshNet.NET45/Properties/AssemblyInfo.cs b/src/Renci.SshNet.NET45/Properties/AssemblyInfo.cs
new file mode 100644
index 000000000..f186bff16
--- /dev/null
+++ b/src/Renci.SshNet.NET45/Properties/AssemblyInfo.cs
@@ -0,0 +1,6 @@
+using System.Reflection;
+using System.Runtime.CompilerServices;
+using System.Runtime.InteropServices;
+
+[assembly: AssemblyTitle("SSH.NET .NET 4.5")]
+[assembly: Guid("c5b64f05-d4d7-4ea9-886a-8c4b9602aa5b")]
diff --git a/src/Renci.SshNet.NET45/Renci.SshNet.NET45.csproj b/src/Renci.SshNet.NET45/Renci.SshNet.NET45.csproj
new file mode 100644
index 000000000..38c4d8613
--- /dev/null
+++ b/src/Renci.SshNet.NET45/Renci.SshNet.NET45.csproj
@@ -0,0 +1,984 @@
+
+
+
+ Debug
+ AnyCPU
+ 8.0.30703
+ 2.0
+ {DAF5FB65-1ABE-465B-BF55-288229FDD16B}
+ Library
+ Properties
+ Renci.SshNet
+ Renci.SshNet
+ v4.5
+ 512
+
+
+ true
+ full
+ false
+ bin\Debug\
+ TRACE;DEBUG;FEATURE_REGEX_COMPILE;FEATURE_BINARY_SERIALIZATION;FEATURE_RNG_CREATE;FEATURE_SOCKET_SYNC;FEATURE_SOCKET_EAP;FEATURE_SOCKET_APM;FEATURE_SOCKET_SETSOCKETOPTION;FEATURE_SOCKET_POLL;FEATURE_STREAM_APM;FEATURE_DNS_SYNC;FEATURE_THREAD_COUNTDOWNEVENT;FEATURE_THREAD_THREADPOOL;FEATURE_THREAD_SLEEP;FEATURE_HASH_MD5;FEATURE_HASH_SHA1_CREATE;FEATURE_HASH_SHA256_CREATE;FEATURE_HASH_SHA384_CREATE;FEATURE_HASH_SHA512_CREATE;FEATURE_HASH_RIPEMD160_CREATE;FEATURE_HMAC_MD5;FEATURE_HMAC_SHA1;FEATURE_HMAC_SHA256;FEATURE_HMAC_SHA384;FEATURE_HMAC_SHA512;FEATURE_HMAC_RIPEMD160;FEATURE_MEMORYSTREAM_GETBUFFER;FEATURE_DIAGNOSTICS_TRACESOURCE;FEATURE_ENCODING_ASCII
+ prompt
+ 4
+ true
+ bin\Debug\Renci.SshNet.xml
+ 5
+
+
+ none
+ true
+ bin\Release\
+ TRACE;FEATURE_REGEX_COMPILE;FEATURE_BINARY_SERIALIZATION;FEATURE_RNG_CREATE;FEATURE_SOCKET_SYNC;FEATURE_SOCKET_EAP;FEATURE_SOCKET_APM;FEATURE_SOCKET_SETSOCKETOPTION;FEATURE_SOCKET_POLL;FEATURE_STREAM_APM;FEATURE_DNS_SYNC;FEATURE_THREAD_COUNTDOWNEVENT;FEATURE_THREAD_THREADPOOL;FEATURE_THREAD_SLEEP;FEATURE_HASH_MD5;FEATURE_HASH_SHA1_CREATE;FEATURE_HASH_SHA256_CREATE;FEATURE_HASH_SHA384_CREATE;FEATURE_HASH_SHA512_CREATE;FEATURE_HASH_RIPEMD160_CREATE;FEATURE_HMAC_MD5;FEATURE_HMAC_SHA1;FEATURE_HMAC_SHA256;FEATURE_HMAC_SHA384;FEATURE_HMAC_SHA512;FEATURE_HMAC_RIPEMD160;FEATURE_MEMORYSTREAM_GETBUFFER;FEATURE_DIAGNOSTICS_TRACESOURCE;FEATURE_ENCODING_ASCII
+ prompt
+ 4
+ bin\Release\Renci.SshNet.xml
+
+
+ true
+ 5
+
+
+ true
+
+
+ ..\Renci.SshNet.snk
+
+
+
+
+
+
+
+
+ Abstractions\CryptoAbstraction.cs
+
+
+ Abstractions\DiagnosticAbstraction.cs
+
+
+ Abstractions\DnsAbstraction.cs
+
+
+ Abstractions\FileSystemAbstraction.cs
+
+
+ Abstractions\ReflectionAbstraction.cs
+
+
+ Abstractions\SocketAbstraction.cs
+
+
+ Abstractions\ThreadAbstraction.cs
+
+
+ AuthenticationMethod.cs
+
+
+ AuthenticationResult.cs
+
+
+ BaseClient.cs
+
+
+ Channels\Channel.cs
+
+
+ Channels\ChannelDirectTcpip.cs
+
+
+ Channels\ChannelForwardedTcpip.cs
+
+
+ Channels\ChannelSession.cs
+
+
+ Channels\ChannelTypes.cs
+
+
+ Channels\ClientChannel.cs
+
+
+ Channels\IChannel.cs
+
+
+ Channels\IChannelDirectTcpip.cs
+
+
+ Channels\IChannelForwardedTcpip.cs
+
+
+ Channels\IChannelSession.cs
+
+
+ Channels\ServerChannel.cs
+
+
+ CipherInfo.cs
+
+
+ ClientAuthentication.cs
+
+
+ CommandAsyncResult.cs
+
+
+ Common\Array.cs
+
+
+ Common\ASCIIEncoding.cs
+
+
+ Common\AsyncResult.cs
+
+
+ Common\AuthenticationBannerEventArgs.cs
+
+
+ Common\AuthenticationEventArgs.cs
+
+
+ Common\AuthenticationPasswordChangeEventArgs.cs
+
+
+ Common\AuthenticationPrompt.cs
+
+
+ Common\AuthenticationPromptEventArgs.cs
+
+
+ Common\BigInteger.cs
+
+
+ Common\ChannelDataEventArgs.cs
+
+
+ Common\ChannelEventArgs.cs
+
+
+ Common\ChannelExtendedDataEventArgs.cs
+
+
+ Common\ChannelOpenConfirmedEventArgs.cs
+
+
+ Common\ChannelOpenFailedEventArgs.cs
+
+
+ Common\ChannelRequestEventArgs.cs
+
+
+ Common\CountdownEvent.cs
+
+
+ Common\DerData.cs
+
+
+ Common\ExceptionEventArgs.cs
+
+
+ Common\Extensions.cs
+
+
+ Common\HostKeyEventArgs.cs
+
+
+ Common\NetConfServerException.cs
+
+
+ Common\ObjectIdentifier.cs
+
+
+ Common\Pack.cs
+
+
+ Common\PipeStream.cs
+
+
+ Common\PortForwardEventArgs.cs
+
+
+ Common\PosixPath.cs
+
+
+ Common\ProxyException.cs
+
+
+ Common\ScpDownloadEventArgs.cs
+
+
+ Common\ScpException.cs
+
+
+ Common\ScpUploadEventArgs.cs
+
+
+ Common\SemaphoreLight.cs
+
+
+ Common\SftpPathNotFoundException.cs
+
+
+ Common\SftpPermissionDeniedException.cs
+
+
+ Common\ShellDataEventArgs.cs
+
+
+ Common\SshAuthenticationException.cs
+
+
+ Common\SshConnectionException.cs
+
+
+ Common\SshData.cs
+
+
+ Common\SshDataStream.cs
+
+
+ Common\SshException.cs
+
+
+ Common\SshOperationTimeoutException.cs
+
+
+ Common\SshPassPhraseNullOrEmptyException.cs
+
+
+ Common\TerminalModes.cs
+
+
+ Compression\CompressionMode.cs
+
+
+ Compression\Compressor.cs
+
+
+ Compression\Zlib.cs
+
+
+ Compression\ZlibOpenSsh.cs
+
+
+ Compression\ZlibStream.cs
+
+
+ ConnectionInfo.cs
+
+
+ ExpectAction.cs
+
+
+ ExpectAsyncResult.cs
+
+
+ ForwardedPort.cs
+
+
+ ForwardedPortDynamic.cs
+
+
+ ForwardedPortDynamic.NET.cs
+
+
+ ForwardedPortLocal.cs
+
+
+ ForwardedPortLocal.NET.cs
+
+
+ ForwardedPortRemote.cs
+
+
+ ForwardedPortStatus.cs
+
+
+ HashInfo.cs
+
+
+ IAuthenticationMethod.cs
+
+
+ IClientAuthentication.cs
+
+
+ IConnectionInfo.cs
+
+
+ IForwardedPort.cs
+
+
+ IRemotePathTransformation.cs
+
+
+ IServiceFactory.cs
+
+
+ IServiceFactory.NET.cs
+
+
+ ISession.cs
+
+
+ ISubsystemSession.cs
+
+
+ KeyboardInteractiveAuthenticationMethod.cs
+
+
+ KeyboardInteractiveConnectionInfo.cs
+
+
+ MessageEventArgs.cs
+
+
+ Messages\Authentication\BannerMessage.cs
+
+
+ Messages\Authentication\FailureMessage.cs
+
+
+ Messages\Authentication\InformationRequestMessage.cs
+
+
+ Messages\Authentication\InformationResponseMessage.cs
+
+
+ Messages\Authentication\PasswordChangeRequiredMessage.cs
+
+
+ Messages\Authentication\PublicKeyMessage.cs
+
+
+ Messages\Authentication\RequestMessage.cs
+
+
+ Messages\Authentication\RequestMessageHost.cs
+
+
+ Messages\Authentication\RequestMessageKeyboardInteractive.cs
+
+
+ Messages\Authentication\RequestMessageNone.cs
+
+
+ Messages\Authentication\RequestMessagePassword.cs
+
+
+ Messages\Authentication\RequestMessagePublicKey.cs
+
+
+ Messages\Authentication\SuccessMessage.cs
+
+
+ Messages\Connection\CancelTcpIpForwardGlobalRequestMessage.cs
+
+
+ Messages\Connection\ChannelCloseMessage.cs
+
+
+ Messages\Connection\ChannelDataMessage.cs
+
+
+ Messages\Connection\ChannelEofMessage.cs
+
+
+ Messages\Connection\ChannelExtendedDataMessage.cs
+
+
+ Messages\Connection\ChannelFailureMessage.cs
+
+
+ Messages\Connection\ChannelMessage.cs
+
+
+ Messages\Connection\ChannelOpenConfirmationMessage.cs
+
+
+ Messages\Connection\ChannelOpenFailureMessage.cs
+
+
+ Messages\Connection\ChannelOpenFailureReasons.cs
+
+
+ Messages\Connection\ChannelOpen\ChannelOpenInfo.cs
+
+
+ Messages\Connection\ChannelOpen\ChannelOpenMessage.cs
+
+
+ Messages\Connection\ChannelOpen\DirectTcpipChannelInfo.cs
+
+
+ Messages\Connection\ChannelOpen\ForwardedTcpipChannelInfo.cs
+
+
+ Messages\Connection\ChannelOpen\SessionChannelOpenInfo.cs
+
+
+ Messages\Connection\ChannelOpen\X11ChannelOpenInfo.cs
+
+
+ Messages\Connection\ChannelRequest\BreakRequestInfo.cs
+
+
+ Messages\Connection\ChannelRequest\ChannelRequestMessage.cs
+
+
+ Messages\Connection\ChannelRequest\EndOfWriteRequestInfo.cs
+
+
+ Messages\Connection\ChannelRequest\EnvironmentVariableRequestInfo.cs
+
+
+ Messages\Connection\ChannelRequest\ExecRequestInfo.cs
+
+
+ Messages\Connection\ChannelRequest\ExitSignalRequestInfo.cs
+
+
+ Messages\Connection\ChannelRequest\ExitStatusRequestInfo.cs
+
+
+ Messages\Connection\ChannelRequest\KeepAliveRequestInfo.cs
+
+
+ Messages\Connection\ChannelRequest\PseudoTerminalInfo.cs
+
+
+ Messages\Connection\ChannelRequest\RequestInfo.cs
+
+
+ Messages\Connection\ChannelRequest\ShellRequestInfo.cs
+
+
+ Messages\Connection\ChannelRequest\SignalRequestInfo.cs
+
+
+ Messages\Connection\ChannelRequest\SubsystemRequestInfo.cs
+
+
+ Messages\Connection\ChannelRequest\WindowChangeRequestInfo.cs
+
+
+ Messages\Connection\ChannelRequest\X11ForwardingRequestInfo.cs
+
+
+ Messages\Connection\ChannelRequest\XonXoffRequestInfo.cs
+
+
+ Messages\Connection\ChannelSuccessMessage.cs
+
+
+ Messages\Connection\ChannelWindowAdjustMessage.cs
+
+
+ Messages\Connection\GlobalRequestMessage.cs
+
+
+ Messages\Connection\GlobalRequestName.cs
+
+
+ Messages\Connection\RequestFailureMessage.cs
+
+
+ Messages\Connection\RequestSuccessMessage.cs
+
+
+ Messages\Connection\TcpIpForwardGlobalRequestMessage.cs
+
+
+ Messages\Message.cs
+
+
+ Messages\MessageAttribute.cs
+
+
+ Messages\ServiceName.cs
+
+
+ Messages\Transport\DebugMessage.cs
+
+
+ Messages\Transport\DisconnectMessage.cs
+
+
+ Messages\Transport\DisconnectReason.cs
+
+
+ Messages\Transport\IgnoreMessage.cs
+
+
+ Messages\Transport\IKeyExchangedAllowed.cs
+
+
+ Messages\Transport\KeyExchangeDhGroupExchangeGroup.cs
+
+
+ Messages\Transport\KeyExchangeDhGroupExchangeInit.cs
+
+
+ Messages\Transport\KeyExchangeDhGroupExchangeReply.cs
+
+
+ Messages\Transport\KeyExchangeDhGroupExchangeRequest.cs
+
+
+ Messages\Transport\KeyExchangeDhInitMessage.cs
+
+
+ Messages\Transport\KeyExchangeDhReplyMessage.cs
+
+
+ Messages\Transport\KeyExchangeEcdhInitMessage.cs
+
+
+ Messages\Transport\KeyExchangeEcdhReplyMessage.cs
+
+
+ Messages\Transport\KeyExchangeInitMessage.cs
+
+
+ Messages\Transport\NewKeysMessage.cs
+
+
+ Messages\Transport\ServiceAcceptMessage.cs
+
+
+ Messages\Transport\ServiceRequestMessage.cs
+
+
+ Messages\Transport\UnimplementedMessage.cs
+
+
+ NetConfClient.cs
+
+
+ Netconf\INetConfSession.cs
+
+
+ Netconf\NetConfSession.cs
+
+
+ NoneAuthenticationMethod.cs
+
+
+ PasswordAuthenticationMethod.cs
+
+
+ PasswordConnectionInfo.cs
+
+
+ PrivateKeyAuthenticationMethod.cs
+
+
+ PrivateKeyConnectionInfo.cs
+
+
+ PrivateKeyFile.cs
+
+
+ ProxyTypes.cs
+
+
+ RemotePathDoubleQuoteTransformation.cs
+
+
+ RemotePathNoneTransformation.cs
+
+
+ RemotePathShellQuoteTransformation.cs
+
+
+ RemotePathTransformation.cs
+
+
+ ScpClient.cs
+
+
+ ScpClient.NET.cs
+
+
+ Security\Algorithm.cs
+
+
+ Security\CertificateHostAlgorithm.cs
+
+
+ Security\Cryptography\AsymmetricCipher.cs
+
+
+ Security\Cryptography\BlockCipher.cs
+
+
+ Security\Cryptography\Cipher.cs
+
+
+ Security\Cryptography\CipherDigitalSignature.cs
+
+
+ Security\Cryptography\Ciphers\AesCipher.cs
+
+
+ Security\Cryptography\Ciphers\Arc4Cipher.cs
+
+
+ Security\Cryptography\Ciphers\BlowfishCipher.cs
+
+
+ Security\Cryptography\Ciphers\CastCipher.cs
+
+
+ Security\Cryptography\Ciphers\CipherMode.cs
+
+
+ Security\Cryptography\Ciphers\CipherPadding.cs
+
+
+ Security\Cryptography\Ciphers\DesCipher.cs
+
+
+ Security\Cryptography\Ciphers\Modes\CbcCipherMode.cs
+
+
+ Security\Cryptography\Ciphers\Modes\CfbCipherMode.cs
+
+
+ Security\Cryptography\Ciphers\Modes\CtrCipherMode.cs
+
+
+ Security\Cryptography\Ciphers\Modes\OfbCipherMode.cs
+
+
+ Security\Cryptography\Ciphers\Paddings\PKCS5Padding.cs
+
+
+ Security\Cryptography\Ciphers\Paddings\PKCS7Padding.cs
+
+
+ Security\Cryptography\Ciphers\RsaCipher.cs
+
+
+ Security\Cryptography\Ciphers\SerpentCipher.cs
+
+
+ Security\Cryptography\Ciphers\TripleDesCipher.cs
+
+
+ Security\Cryptography\Ciphers\TwofishCipher.cs
+
+
+ Security\Cryptography\DigitalSignature.cs
+
+
+ Security\Cryptography\DsaDigitalSignature.cs
+
+
+ Security\Cryptography\DsaKey.cs
+
+
+ Security\Cryptography\HMACMD5.cs
+
+
+ Security\Cryptography\HMACSHA1.cs
+
+
+ Security\Cryptography\HMACSHA256.cs
+
+
+ Security\Cryptography\HMACSHA384.cs
+
+
+ Security\Cryptography\HMACSHA512.cs
+
+
+ Security\Cryptography\Key.cs
+
+
+ Security\Cryptography\RsaDigitalSignature.cs
+
+
+ Security\Cryptography\RsaKey.cs
+
+
+ Security\Cryptography\StreamCipher.cs
+
+
+ Security\Cryptography\SymmetricCipher.cs
+
+
+ Security\GroupExchangeHashData.cs
+
+
+ Security\HostAlgorithm.cs
+
+
+ Security\IKeyExchange.cs
+
+
+ Security\KeyExchange.cs
+
+
+ Security\KeyExchangeDiffieHellman.cs
+
+
+ Security\KeyExchangeDiffieHellmanGroup14Sha1.cs
+
+
+ Security\KeyExchangeDiffieHellmanGroup1Sha1.cs
+
+
+ Security\KeyExchangeDiffieHellmanGroupExchangeSha1.cs
+
+
+ Security\KeyExchangeDiffieHellmanGroupExchangeSha256.cs
+
+
+ Security\KeyExchangeDiffieHellmanGroupExchangeShaBase.cs
+
+
+ Security\KeyExchangeDiffieHellmanGroupSha1.cs
+
+
+ Security\KeyHostAlgorithm.cs
+
+
+ ServiceFactory.cs
+
+
+ ServiceFactory.NET.cs
+
+
+ Session.cs
+
+
+ SftpClient.cs
+
+
+ Sftp\Flags.cs
+
+
+ Sftp\ISftpFileReader.cs
+
+
+ Sftp\ISftpResponseFactory.cs
+
+
+ Sftp\ISftpSession.cs
+
+
+ Sftp\Requests\ExtendedRequests\FStatVfsRequest.cs
+
+
+ Sftp\Requests\ExtendedRequests\HardLinkRequest.cs
+
+
+ Sftp\Requests\ExtendedRequests\PosixRenameRequest.cs
+
+
+ Sftp\Requests\ExtendedRequests\StatVfsRequest.cs
+
+
+ Sftp\Requests\SftpBlockRequest.cs
+
+
+ Sftp\Requests\SftpCloseRequest.cs
+
+
+ Sftp\Requests\SftpExtendedRequest.cs
+
+
+ Sftp\Requests\SftpFSetStatRequest.cs
+
+
+ Sftp\Requests\SftpFStatRequest.cs
+
+
+ Sftp\Requests\SftpInitRequest.cs
+
+
+ Sftp\Requests\SftpLinkRequest.cs
+
+
+ Sftp\Requests\SftpLStatRequest.cs
+
+
+ Sftp\Requests\SftpMkDirRequest.cs
+
+
+ Sftp\Requests\SftpOpenDirRequest.cs
+
+
+ Sftp\Requests\SftpOpenRequest.cs
+
+
+ Sftp\Requests\SftpReadDirRequest.cs
+
+
+ Sftp\Requests\SftpReadLinkRequest.cs
+
+
+ Sftp\Requests\SftpReadRequest.cs
+
+
+ Sftp\Requests\SftpRealPathRequest.cs
+
+
+ Sftp\Requests\SftpRemoveRequest.cs
+
+
+ Sftp\Requests\SftpRenameRequest.cs
+
+
+ Sftp\Requests\SftpRequest.cs
+
+
+ Sftp\Requests\SftpRmDirRequest.cs
+
+
+ Sftp\Requests\SftpSetStatRequest.cs
+
+
+ Sftp\Requests\SftpStatRequest.cs
+
+
+ Sftp\Requests\SftpSymLinkRequest.cs
+
+
+ Sftp\Requests\SftpUnblockRequest.cs
+
+
+ Sftp\Requests\SftpWriteRequest.cs
+
+
+ Sftp\Responses\ExtendedReplies\ExtendedReplyInfo.cs
+
+
+ Sftp\Responses\ExtendedReplies\StatVfsReplyInfo.cs
+
+
+ Sftp\Responses\SftpAttrsResponse.cs
+
+
+ Sftp\Responses\SftpDataResponse.cs
+
+
+ Sftp\Responses\SftpExtendedReplyResponse.cs
+
+
+ Sftp\Responses\SftpHandleResponse.cs
+
+
+ Sftp\Responses\SftpNameResponse.cs
+
+
+ Sftp\Responses\SftpResponse.cs
+
+
+ Sftp\Responses\SftpStatusResponse.cs
+
+
+ Sftp\Responses\SftpVersionResponse.cs
+
+
+ Sftp\SftpCloseAsyncResult.cs
+
+
+ Sftp\SftpDownloadAsyncResult.cs
+
+
+ Sftp\SftpFile.cs
+
+
+ Sftp\SftpFileAttributes.cs
+
+
+ Sftp\SftpFileReader.cs
+
+
+ Sftp\SftpFileStream.cs
+
+
+ Sftp\SftpFileSystemInformation.cs
+
+
+ Sftp\SftpListDirectoryAsyncResult.cs
+
+
+ Sftp\SftpMessage.cs
+
+
+ Sftp\SftpMessageTypes.cs
+
+
+ Sftp\SftpOpenAsyncResult.cs
+
+
+ Sftp\SftpReadAsyncResult.cs
+
+
+ Sftp\SftpRealPathAsyncResult.cs
+
+
+ Sftp\SftpResponseFactory.cs
+
+
+ Sftp\SftpSession.cs
+
+
+ Sftp\SFtpStatAsyncResult.cs
+
+
+ Sftp\SftpSynchronizeDirectoriesAsyncResult.cs
+
+
+ Sftp\SftpUploadAsyncResult.cs
+
+
+ Sftp\StatusCodes.cs
+
+
+ Shell.cs
+
+
+ ShellStream.cs
+
+
+ SshClient.cs
+
+
+ SshCommand.cs
+
+
+ SshMessageFactory.cs
+
+
+ SubsystemSession.cs
+
+
+
+
+ Properties\CommonAssemblyInfo.cs
+
+
+
+
+
+ Renci.SshNet.snk
+
+
+
+
+
+
+
+
+
+
\ No newline at end of file
diff --git a/src/Renci.SshNet.NET45/SftpClientExtensions.cs b/src/Renci.SshNet.NET45/SftpClientExtensions.cs
new file mode 100644
index 000000000..19f9eabec
--- /dev/null
+++ b/src/Renci.SshNet.NET45/SftpClientExtensions.cs
@@ -0,0 +1,179 @@
+using System;
+using System.Collections.Generic;
+using System.IO;
+using System.Threading.Tasks;
+using Renci.SshNet.Sftp;
+using Renci.SshNet.Common;
+
+namespace Renci.SshNet
+{
+ ///
+ /// The SftpClient extensions to implement the Task-based Asynchronous Pattern (TAP) over the originally implemented Asynchronous Programming Model (APM).
+ ///
+ public static class SftpClientExtensions
+ {
+ ///
+ /// Asynchronously downloads a remote file specified by the path into the stream.
+ ///
+ ///
+ /// File to download.
+ /// Stream to write the file into.
+ /// The download callback.
+ /// is null.
+ /// is null or contains only whitespace characters.
+ /// Client is not connected.
+ /// Permission to perform the operation was denied by the remote host. -or- A SSH command was denied by the server.
+ /// was not found on the remote host.///
+ /// A SSH error where is the message from the remote host.
+ /// The method was called after the client was disposed.
+ ///
+ /// Method calls made by this method to , may under certain conditions result in exceptions thrown by the stream.
+ ///
+ public static Task DownloadFileAsync(this SftpClient sftpClient, string path, Stream output, Action downloadCallback = null)
+ {
+ if (sftpClient == null)
+ throw new ArgumentNullException("sftpClient");
+
+ var tcs = new TaskCompletionSource();
+ sftpClient.BeginDownloadFile(path, output, iar =>
+ {
+ try
+ {
+ sftpClient.EndDownloadFile(iar);
+ tcs.TrySetResult(true);
+ }
+ catch (OperationCanceledException)
+ {
+ tcs.TrySetCanceled();
+ }
+ catch (Exception exc)
+ {
+ tcs.TrySetException(exc);
+ }
+ }, null, downloadCallback);
+ return tcs.Task;
+ }
+
+ ///
+ /// Asynchronously retrieves list of files in remote directory.
+ ///
+ ///
+ /// The path.
+ /// The list callback.
+ ///
+ /// A list of files.
+ ///
+ /// The method was called after the client was disposed.
+ public static Task> ListDirectoryAsync(this SftpClient sftpClient, string path, Action listCallback = null)
+ {
+ if (sftpClient == null)
+ throw new ArgumentNullException("sftpClient");
+
+ var tcs = new TaskCompletionSource>();
+ sftpClient.BeginListDirectory(path, iar =>
+ {
+ try
+ {
+ tcs.TrySetResult(sftpClient.EndListDirectory(iar));
+ }
+ catch (OperationCanceledException)
+ {
+ tcs.TrySetCanceled();
+ }
+ catch (Exception exc)
+ {
+ tcs.TrySetException(exc);
+ }
+ }, null, listCallback);
+ return tcs.Task;
+ }
+
+
+ ///
+ /// Asynchronously synchronizes the directories.
+ ///
+ ///
+ /// The source path.
+ /// The destination path.
+ /// The search pattern.
+ ///
+ /// A list of uploaded files.
+ ///
+ /// is null.
+ /// is null or contains only whitespace.
+ /// was not found on the remote host.
+ public static Task> SynchronizeDirectoriesAsync(this SftpClient sftpClient
+ , string sourcePath, string destinationPath, string searchPattern)
+ {
+ if (sftpClient == null)
+ throw new ArgumentNullException("sftpClient");
+
+ return Task>.Factory.FromAsync(sftpClient.BeginSynchronizeDirectories,
+ sftpClient.EndSynchronizeDirectories, sourcePath, destinationPath, searchPattern, null);
+ }
+
+ ///
+ /// Asynchronously uploads stream into remote file. If the file exists it will be overwritten.
+ ///
+ ///
+ /// Data input stream.
+ /// Remote file path.
+ /// The upload callback.
+ /// is null.
+ /// is null or contains only whitespace characters.
+ /// Client is not connected.
+ /// Permission to upload the file was denied by the remote host. -or- A SSH command was denied by the server.
+ /// A SSH error where is the message from the remote host.
+ /// The method was called after the client was disposed.
+ ///
+ /// Method calls made by this method to , may under certain conditions result in exceptions thrown by the stream.
+ ///
+ public static Task UploadFileAsync(this SftpClient sftpClient, Stream input, string path, Action uploadCallback = null)
+ {
+ return UploadFileAsync(sftpClient, input, path, true, uploadCallback);
+ }
+
+ ///
+ /// Asynchronously uploads stream into remote file.
+ ///
+ ///
+ /// Data input stream.
+ /// Remote file path.
+ /// if set to true then existing file will be overwritten.
+ /// The upload callback.
+ /// is null.
+ /// is null or contains only whitespace characters.
+ /// Client is not connected.
+ /// Permission to upload the file was denied by the remote host. -or- A SSH command was denied by the server.
+ /// A SSH error where is the message from the remote host.
+ /// The method was called after the client was disposed.
+ ///
+ /// Method calls made by this method to , may under certain conditions result in exceptions thrown by the stream.
+ ///
+ public static Task UploadFileAsync(this SftpClient sftpClient, Stream input, string path, bool canOverride, Action uploadCallback = null)
+ {
+ if (sftpClient == null)
+ throw new ArgumentNullException("sftpClient");
+
+ var tcs = new TaskCompletionSource();
+ sftpClient.BeginUploadFile(input, path, canOverride, iar =>
+ {
+ try
+ {
+ sftpClient.EndUploadFile(iar);
+ tcs.TrySetResult(true);
+ }
+ catch (OperationCanceledException)
+ {
+ tcs.TrySetCanceled();
+ }
+ catch (Exception exc)
+ {
+ tcs.TrySetException(exc);
+ }
+ }, null, uploadCallback);
+ return tcs.Task;
+ }
+
+ }
+}
diff --git a/src/Renci.SshNet.VS2017.sln b/src/Renci.SshNet.VS2017.sln
index 00469f612..c28864763 100644
--- a/src/Renci.SshNet.VS2017.sln
+++ b/src/Renci.SshNet.VS2017.sln
@@ -27,6 +27,8 @@ Project("{FAE04EC0-301F-11D3-BF4B-00C04F79EFBC}") = "Renci.SshNet.NET35", "Renci
EndProject
Project("{9A19103F-16F7-4668-BE54-9A1E7A4F7556}") = "Renci.SshNet.NETCore", "Renci.SshNet.NETCore\Renci.SshNet.NETCore.csproj", "{8E8229EB-6780-4A8A-B470-E2023FA55AB5}"
EndProject
+Project("{FAE04EC0-301F-11D3-BF4B-00C04F79EFBC}") = "Renci.SshNet.NET45", "Renci.SshNet.NET45\Renci.SshNet.NET45.csproj", "{DAF5FB65-1ABE-465B-BF55-288229FDD16B}"
+EndProject
Global
GlobalSection(SolutionConfigurationPlatforms) = preSolution
Debug|Any CPU = Debug|Any CPU
@@ -103,6 +105,26 @@ Global
{8E8229EB-6780-4A8A-B470-E2023FA55AB5}.Release|x64.Build.0 = Release|Any CPU
{8E8229EB-6780-4A8A-B470-E2023FA55AB5}.Release|x86.ActiveCfg = Release|Any CPU
{8E8229EB-6780-4A8A-B470-E2023FA55AB5}.Release|x86.Build.0 = Release|Any CPU
+ {DAF5FB65-1ABE-465B-BF55-288229FDD16B}.Debug|Any CPU.ActiveCfg = Debug|Any CPU
+ {DAF5FB65-1ABE-465B-BF55-288229FDD16B}.Debug|Any CPU.Build.0 = Debug|Any CPU
+ {DAF5FB65-1ABE-465B-BF55-288229FDD16B}.Debug|ARM.ActiveCfg = Debug|Any CPU
+ {DAF5FB65-1ABE-465B-BF55-288229FDD16B}.Debug|ARM.Build.0 = Debug|Any CPU
+ {DAF5FB65-1ABE-465B-BF55-288229FDD16B}.Debug|Mixed Platforms.ActiveCfg = Debug|Any CPU
+ {DAF5FB65-1ABE-465B-BF55-288229FDD16B}.Debug|Mixed Platforms.Build.0 = Debug|Any CPU
+ {DAF5FB65-1ABE-465B-BF55-288229FDD16B}.Debug|x64.ActiveCfg = Debug|Any CPU
+ {DAF5FB65-1ABE-465B-BF55-288229FDD16B}.Debug|x64.Build.0 = Debug|Any CPU
+ {DAF5FB65-1ABE-465B-BF55-288229FDD16B}.Debug|x86.ActiveCfg = Debug|Any CPU
+ {DAF5FB65-1ABE-465B-BF55-288229FDD16B}.Debug|x86.Build.0 = Debug|Any CPU
+ {DAF5FB65-1ABE-465B-BF55-288229FDD16B}.Release|Any CPU.ActiveCfg = Release|Any CPU
+ {DAF5FB65-1ABE-465B-BF55-288229FDD16B}.Release|Any CPU.Build.0 = Release|Any CPU
+ {DAF5FB65-1ABE-465B-BF55-288229FDD16B}.Release|ARM.ActiveCfg = Release|Any CPU
+ {DAF5FB65-1ABE-465B-BF55-288229FDD16B}.Release|ARM.Build.0 = Release|Any CPU
+ {DAF5FB65-1ABE-465B-BF55-288229FDD16B}.Release|Mixed Platforms.ActiveCfg = Release|Any CPU
+ {DAF5FB65-1ABE-465B-BF55-288229FDD16B}.Release|Mixed Platforms.Build.0 = Release|Any CPU
+ {DAF5FB65-1ABE-465B-BF55-288229FDD16B}.Release|x64.ActiveCfg = Release|Any CPU
+ {DAF5FB65-1ABE-465B-BF55-288229FDD16B}.Release|x64.Build.0 = Release|Any CPU
+ {DAF5FB65-1ABE-465B-BF55-288229FDD16B}.Release|x86.ActiveCfg = Release|Any CPU
+ {DAF5FB65-1ABE-465B-BF55-288229FDD16B}.Release|x86.Build.0 = Release|Any CPU
EndGlobalSection
GlobalSection(SolutionProperties) = preSolution
HideSolutionNode = FALSE
@@ -111,6 +133,9 @@ Global
{94EE3919-19FA-4D9B-8DA9-249050B15232} = {2D6CAE62-D053-476F-9BDD-2B1F27FA9C5D}
{A6C3FFD3-16A5-44D3-8C1F-3613D6DD17D1} = {2D6CAE62-D053-476F-9BDD-2B1F27FA9C5D}
EndGlobalSection
+ GlobalSection(ExtensibilityGlobals) = postSolution
+ SolutionGuid = {F967A6EB-4FBA-4585-95B3-D7435F47375E}
+ EndGlobalSection
GlobalSection(TestCaseManagementSettings) = postSolution
CategoryFile = Renci.SshNet1.vsmdi
EndGlobalSection