Reputation: 429
I'm using WinSCPnet.dll
in my project and to run correctly it needs WinSCP.exe
in the launch directory e.g. project_path/obj/Debug
. But if I want to use my program, it needs to have this .exe
file all the time in the same folder otherwise the program will crash.
Is it possible to place WinSCP.exe
into project resources so I don't have to place it in the same directory every time I move it?
Upvotes: 2
Views: 1456
Reputation: 202232
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.
Upvotes: 2