'Could load a file or assembly "Renci.SshNet.dll"

Issue :

System.IO.FileNotFoundException: Could not load file or assembly 'Renci.SshNet, Version=2014.4.6.0, Culture=neutral, PublicKeyToken=1cee9f8bde3db106' or one of its dependencies. The system cannot find the file specified.

The Project is built on .Net Framework 4 which helps to transfer the files from local onto S FTP Server.

The Code works fine on my local machine without any issue,When deployed on the PROD server and run as per scheduled giving the error as mentioned above.

Let me know what exactly causing this issue.



Solution 1:[1]

If not installing from the gallery make sure the DLL is not marked as blocked. Windows will mark the zip and every file in it for security reasons and you will have to unblock them

Solution 2:[2]

Are you developing windows or web application? If web application, try enabling an option in IIS application pool -> Advanced Settings, "Enable 32 bit application" to true. This might solve your problem.

In case of windows or console application, select the reference Renci.SshNet dll and go to its properties and set "Specific version" to false.

Solution 3:[3]

After recently upgrading my .NET connector it gave the same error. I compile and run my app in VS and it works fine guessing because it copies all the MySQL NET assemblies to the exe folder so what I did is copied Renci.SshNet.dll to the directory of my exe and it worked. For some reason adding the path to the path system variable didn't help. Final solution was to remove the NET Connector and use mysqld in batch to do the selects and updates for the app.

Solution 4:[4]

Looks like you're missing the Renci.SshNet.dll.

In your project references you can edit the properties of Renci.SshNet. Make sure "Copy Local" ist set to true. It will copy the dll on build to your output directory (should be bin/Release).

Sources

This article follows the attribution requirements of Stack Overflow and is licensed under CC BY-SA 3.0.

Source: Stack Overflow

Solution Source
Solution 1 Rai Vu
Solution 2 Deepan Maheswaran
Solution 3
Solution 4 DasBaconfist