Results 1 to 3 of 3

Thread: SSH.NET loading error

  1. #1

    Thread Starter
    Hyperactive Member
    Join Date
    Apr 2010
    Posts
    478

    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.

  2. #2
    You don't want to know.
    Join Date
    Aug 2010
    Posts
    4,578

    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.

  3. #3
    Frenzied Member
    Join Date
    Dec 2014
    Location
    VB6 dinosaur land
    Posts
    1,191

    Re: SSH.NET loading error

    Quote Originally Posted by aspfun View Post
    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
  •  



Click Here to Expand Forum to Full Width