Sudheer Reddy
Sudheer Reddy

Reputation: 59

Using WinSCP .NET assembly on Linux

I have deployed my application based on WinSCP .NET assembly in Linux. I'm getting this error:

WinSCP.SessionLocalException: The winscp.exe executable was not found at the location of the assembly WinSCPnet

SessionOptions sessionOptions = new SessionOptions
{
    Protocol = Protocol.Sftp,
    HostName = _sftpConfig["Host"],
    UserName = _sftpConfig["UserName"],
    Password = _sftpConfig["Password"],
};

Upvotes: 4

Views: 1662

Answers (1)

Martin Prikryl
Martin Prikryl

Reputation: 202232

WinSCP .NET assembly is a wrapper around WinSCP.exe scripting interface.

WinSCP is a Windows application. It does not run on Linux on its own. Consequently, the assembly is not really intended to be used on Linux. Quoting WinSCP .NET assembly documentation:

The library is primarily intended for advanced automation tasks on Microsoft Windows that require conditional processing, loops or other control structures for which the basic scripting interface is too limited.


On the other hand, standalone WinSCP works under Linux using Wine without any problem. And there's .NET Core build of the .NET assembly. So it is quite likely that it is possible, but I haven't seen it done yet.

Upvotes: 1

Related Questions