I now understand the problem. It's not a WinSCP issue, it's due to the way assembly loading is handled in PowerShell/.Net...
This is what happened...
1. Launched
powershell.exe.
2. Ran a script that loaded the WinSCP 5.17.8 DLL (
Add-Type -Path "C:\Program Files (x86)\WinSCP\WinSCPnet.dll").
3. Ran a script that loaded the WinSCP 5.18 beta DLL (
Add-Type -Path "C:\Bitbucket\WinSCP-5.18.beta-Automation\WinSCPnet.dll").
I didn't realise that the PowerShell session now had two versions of the WinSCP assembly loaded:
(get-item ([System.AppDomain]::CurrentDomain.GetAssemblies()).Where({$_.Location -like "*WinSCP*"}).Location).VersionInfo | Select-Object ProductVersion, FileName
ProductVersion FileName
-------------- --------
5.17.8.0 C:\Program Files (x86)\WinSCP\WinSCPnet.dll
5.18.0.0 C:\Bitbucket\WinSCP-5.18.beta-Automation\WinSCPnet.dll
When I ran the second script, PowerShell implicitly used the first version of the DLL to be loaded.
Question - Does the WinSCP .NET assembly expose any way to check the version number? If not, would it be possible to add such a thing, perhaps a static attribute, for example something like
[WinSCP.Information]::Version.