SessionLocalException by current download

Advertisement

Arne Drews
Joined:
Posts:
5
Location:
Germany

SessionLocalException by current download

Hi,

In some projects I use the assembly for up-/downloading files.
All works nice so far.

Now I want to use the Session.DuplicateFile() Method.
I had a version where this method doesn't exists.

So I downloaded the latest bundle an getting this exception:
WinSCP.SessionLocalException: The version of U:\...\bin\Debug\winscp.exe (5.13.4.0) does not match version of this assembly U:\...\bin\Debug\WinSCPnet.DLL (5.13.1.0).

Both files .exe and .dll are located in the same folder and by showing the properties of the files, both versions are 5.13.4 so it have to be right?

I'm working with Visual Studio 2017 Community.
In my project, I deleted the reference to the winscpnet.dll and renewed it. Is there a step missing?

thanks for help!

Reply with quote

Advertisement

Arne Drews
Joined:
Posts:
5
Location:
Germany

Re: SessionLocalException by current download

martin wrote:

Why don't you use NuGet package?
Is that the answer about why the current download produces a version conflict?

Thanks so far, I installed NuGet-Package-Manager and WinSCP 5.3.14 over it. The files binded to the project seems to be the same, I get by using the official download.
The script I use for testing needs a few minutes to be finished. I send an feedback if it works the NuGet-Way.

Reply with quote

Arne Drews
Joined:
Posts:
5
Location:
Germany

one step further

So with that package it works a step further. The exception about the versions are history.
But now, he's getting a Disconnect-Exception every Time I use DuplicateFile().

I'm using this code:
WinSCP.SessionOptions SessOpts = new WinSCP.SessionOptions {
    Protocol = WinSCP.Protocol.Ftp,
    HostName = "***",
    UserName = "***",
    Password = "***"
};

using ( WinSCP.Session Sess = new WinSCP.Session() ) {

    Sess.Open( SessOpts );

    WinSCP.TransferOptions TransOpts = new WinSCP.TransferOptions();
    TransOpts.TransferMode = WinSCP.TransferMode.Binary;

    WinSCP.TransferOperationResult TransOprtResult;
    TransOprtResult = Sess.PutFiles( sGeneratedFilePath, RemoteFileName, false, TransOpts );

    TransOprtResult.Check();

    Sess.DuplicateFile(
            RemoteFileName,
            RemoteFileName.Replace(".csv", string.Format("_{0}-{1}.csv", DateTime.Now.ToString("yyyyMMdd") , DateTime.Now.ToString("HHmmss")) )
        );

}
Does the TransportOperationResult.Check() Method perform an Disconnect?
I'm getting this one every time:
WinSCP.SessionRemoteException: Lost connection.
Disconnected from server
Error copying file '/import/alle-wz-shopkunden.csv' to '/import/alle-wz-shopkunden_20181004-094901.csv'.

Reply with quote

martin
Site Admin
martin avatar
Joined:
Posts:
41,453
Location:
Prague, Czechia

Re: one step further

Arne Drews wrote:

So with that package it works a step further. The exception about the versions are history.
But now, he's getting a Disconnect-Exception every Time I use DuplicateFile().
Does your FTP server even allow duplicating of files?
Few FTP servers do actually.
See "Direct File duplication" section in https://winscp.net/eng/docs/protocols
If your server does not allow direct file duplication, your only option to is to download the file and upload it back to a new location.

Reply with quote

Advertisement

Arne Drews
Joined:
Posts:
5
Location:
Germany

Hi Martin,

Thanks for the info.
I must say, that I don't know exactly, but if I process duplicating the file over the WinSCP GUI there's no problem. I've unchecked the option "duplicate over local temp file", so it has to be the same process as Session.DuplicateFile(), right?

UserCredentials are the same.

Down- und uploading isn't my favorite :-)
Do I have any other options?

thanks

ps: I'm from germany, so be patient about my english talents ;-)

Reply with quote

Advertisement

You can post new topics in this forum