Shocky Shocky - 1 year ago 219
C# Question

Place WinSCP.exe in project resources for WinSCP .NET assembly

I'm using

in my project and to run correctly it needs
in launch directory e.g.
. But if I want to use my program, it needs to have this
file all the time in same folder otherwise the program will crash.

Is it possible to place
into project resources so I don't have to place it in same directory everytime I move it?

(Sorry for my clunky English, don't downvote me for that :/ If you need some additional info I'll gladly post it)

Answer Source

The winscp.exe has to exist as a real file, at the moment you call the Session.Open.

So while you can store the winscp.exe to your application resources, you have to extract it somewhere (e.g. to a temporary folder), and set the Session.ExecutablePath accordingly, before you call the Session.Open.

Inspired by your question, I have added instructions for Embedding WinSCP executable as resource to the assembly documentation.

Recommended from our users: Dynamic Network Monitoring from WhatsUp Gold from IPSwitch. Free Download