-
Jan 29th, 2018, 02:06 PM
#1
Thread Starter
Hyperactive Member
SSH.NET loading error
I followed the link to create a sftp client.
https://www.codeproject.com/Tips/111...-in-Visual-Stu
It works fine in my local pc and exe file sftp.exe was copied to a file server.
But user got an error once ran copy of sftp.exe file from file server.
This is error.
Could not load file or assembly "Renci.sshnet, ..."
Company block reply feature. I have to reply here
Thank you for help.
I checked my application and found that dll files are in different folders.
Some are in ./bin/debug/ folder and others are in ./package/ folder.
When I copied sftp.exe to a folder mysftp, should I copy all dll files into mysftp folder of file server?
Or, I have to create bin/defug and package folder under mysftp folder?
Last edited by aspfun; Jan 30th, 2018 at 07:51 AM.
-
Jan 29th, 2018, 04:15 PM
#2
Re: SSH.NET loading error
You can't just copy your executable to another machine. You also have to copy any DLLs on which it depends. Sometimes you can install an assembly into a special place called the GAC to skirt that, but it's more complicated and has a lot of downsides and most professional .NET developers gave up on it long ago.
Generally, if you do a Release build, everything that's in the output folder has to come along with your program.
This answer is wrong. You should be using TableAdapter and Dictionaries instead.
-
Jan 30th, 2018, 08:28 AM
#3
Re: SSH.NET loading error
Originally Posted by aspfun
Company block reply feature. I have to reply here
Thank you for help.
I checked my application and found that dll files are in different folders.
Some are in ./bin/debug/ folder and others are in ./package/ folder.
When I copied sftp.exe to a folder mysftp, should I copy all dll files into mysftp folder of file server?
Or, I have to create bin/defug and package folder under mysftp folder?
Yes, you need to copy Renci.SshNet.dll (and any others that you may use) from the bin/Debug (or Release) folder to the same folder as the exe. Typically, third party DLLs are copied local (see Copy Local column of the Project's References) and must be deployed with the exe. If a used DLL is NOT copied local but also not installed on your target system then you'll eventually get an error when that DLL is needed. In that case, either install on the deployed PC or change the Copy Local property so it will be with the exe when you deploy.
For example, we use a DB2 database driver that is not copied local. If we don't install IBM's Client Access on the PC like we always do, the program will error the first time it tries to access DB2. I could just include the DB2 DLLs by copying them local and then deploying them with the exe but we always install Client Access so it's not needed.
Posting Permissions
- You may not post new threads
- You may not post replies
- You may not post attachments
- You may not edit your posts
-
Forum Rules
|
Click Here to Expand Forum to Full Width
|