Resolve method unavailable on WinSCP.ComparisonDifference
Hi,
I'm trying to synchronise folders from remote to local using powershell, I'm using the quickstart here:
https://winscp.net/eng/docs/library_example_keep_local_directory_up_to_date
I'm testing it using powershell ISE as admin.
I've downloaded the latest release of the winscp automation zip, however I'm getting the below error when trying to call Resolve:
Method invocation failed because [WinSCP.ComparisonDifference] does not contain a method named 'Resolve'.
I don't think this is a .Net version issue as it creates and connects the session fine.
I've also tried the net4 and netstandard2 subdirectories for the binary. Both connect fine to the remote server and list contents etc, but both give the same 'Resolve' not available error.
Sample of the important bits, its straight from the quickstart:
Please could someone point out what I did wrong?
Thanks,
I'm trying to synchronise folders from remote to local using powershell, I'm using the quickstart here:
https://winscp.net/eng/docs/library_example_keep_local_directory_up_to_date
I'm testing it using powershell ISE as admin.
I've downloaded the latest release of the winscp automation zip, however I'm getting the below error when trying to call Resolve:
Method invocation failed because [WinSCP.ComparisonDifference] does not contain a method named 'Resolve'.
I don't think this is a .Net version issue as it creates and connects the session fine.
I've also tried the net4 and netstandard2 subdirectories for the binary. Both connect fine to the remote server and list contents etc, but both give the same 'Resolve' not available error.
Sample of the important bits, its straight from the quickstart:
try { # Load WinSCP .NET assembly Add-Type -Path "D:\Job Data\Temp\Alpha\WinSCP-Automation\netstandard2.0\WinSCPnet.dll" # Setup session options $sessionOptions = New-Object WinSCP.SessionOptions -Property @{ Protocol = [WinSCP.Protocol]::Ftp HostName = "xxx" UserName = "xxx" Password = "xxx" FtpSecure = [WinSCP.FtpSecure]::Implicit TlsHostCertificateFingerprint = "xxx" } $session = New-Object WinSCP.Session try { # Connect $session.Open($sessionOptions) $remote = "/Index Data" $local = "D:\Job Data\Temp\Alpha\Index Data" $differences = $session.CompareDirectories([WinSCP.SynchronizationMode]::Local, $local, $remote, $true) Write-Host if ($differences.Count -eq 0) { Write-Host "No changes found." } else { Write-Host "Synchronizing $($differences.Count) change(s)..." foreach ($difference in $differences) { try { $difference.Resolve($session) | Out-Null Write-Host " Done." } catch { Write-Host HandleException $_ } } } } finally { # Disconnect, clean up $session.Dispose() } exit 0 } catch { Write-Host "Error: $($_.Exception.Message)" exit 1 }
Please could someone point out what I did wrong?
Thanks,