Found the issue, the issue was that winscp .net library version didn't match winscp.exe version, reinstalled from scratch and it worked.
- vpuchko
var sessionOptions = new SessionOptions
{
Protocol = Protocol.Sftp,
HostName = _settingsService.GetValue((SFTPSettings s) => s.InboundHost, string.Empty),
UserName = _settingsService.GetValue((SFTPSettings s) => s.InboundUsername, string.Empty),
Password = _settingsService.GetValue((SFTPSettings s) => s.InboundPassword, string.Empty),
SshHostKeyFingerprint = _settingsService.GetValue((SFTPSettings s) => s.InboundSshHostKeyFingerprint, string.Empty)
};
SynchronizationResult result;
using (var session = new Session {ExecutablePath = _winScpPath, DisableVersionCheck = true})
{
session.Open(sessionOptions);
result = session.SynchronizeDirectories(SynchronizationMode.Local, localFolderPath,
folderPath, removeFiles: true);
result.Check();
}