Topic "Unable to embed the WinSCPnet.dll into C# .exe file."

Author Message
solutionsville
[View user's profile]

Joined: 2016-10-20
Posts: 18
Location: Ft Worth
Martin, I am not able to embed the dll into my project. I get an error concerning not the correct assembly version. Is there something in the dll that is preventing this?

The error I get when I run the program is;

The version of C:\Program Files (x86(WinSCP\WinSCP.exe(5.9.2.0) does not match version of this assembly F:\CnaFirmware.exe (1.0.0.0).
Thanks,
Advertisements
martin◆
[View user's profile]
Site Admin
Joined: 2002-12-10
Posts: 26730
Location: Prague, Czechia
I've never seen this problem before.

I'm sending you an email with a development version of WinSCP to the address you have used to register on this forum.

Please enable debug logging (Session.DebugLogPath) and send me the log.
solutionsville
[View user's profile]

Joined: 2016-10-20
Posts: 18
Location: Ft Worth
Hi Martin, I did not even get to the point of running the app.

As soon as I change the WinSCPnet Reference Properties Embed Interop Types = true, it gives me; Interop type 'Session', 'FileTransferProgressEventArgs', 'OutputDataReceivedEventArgs', "Session Options', 'TransferOptions', 'TransferOptionsResult' cannot be embedded. Use the applicable interface instead.

Set the field to False, and the errors clear.

Note here that the WinSCPnet.dll is not a project resource. It is a reference and is added to the project from Tortoise SVN, so it never shows as a resource. That may be part of the issue.

Let me know what else you would like me to try if anything. I am thinking that I will just have to distribute the WinSCPnet.dll with the executable. The users that will be using this app I am developing will most likely have WinSCP installed.
martin◆
[View user's profile]
Site Admin
Joined: 2002-12-10
Posts: 26730
Location: Prague, Czechia
OK, I understand now, what do you mean by "embed". I was not aware of this feature.

You have to set Session.DisableVersionCheck = true.
_________________
Martin Prikryl
solutionsville
[View user's profile]

Joined: 2016-10-20
Posts: 18
Location: Ft Worth
Cool. That stopped the error message. Now it is not embedding the file still. That is not a WinSCP thing, so I need to figure that one out. I will let you know if I figure out anything.

Thanks Martin.
solutionsville
[View user's profile]

Joined: 2016-10-20
Posts: 18
Location: Ft Worth
Martin, if you follow these steps, you can embed a/your DLL into the project so that you do not have to distribute it with the EXE if you are building it custom.

https://www.codeproject.com/Articles/528178/Load-DLL-From-Embedded-Resource
martin◆
[View user's profile]
Site Admin
Joined: 2002-12-10
Posts: 26730
Location: Prague, Czechia
Thanks!
Advertisements

You can post new topics in this forum

Search

What is WinSCP?

It is award-winning SFTP client, SCP client, FTPS client and FTP client integrated into one software program for file transfer to FTP server or secure SFTP server. [More]

And it's free!

Donate

About donations

$9   $19   $49   $99

About donations

Recommend

WinSCP Privacy Policy

WinSCP License