32bit binary for a .net 3.5 console app

Sep 18, 2012 at 6:34 PM

Hi all, 

I've added a reference to the .net 3.5 dll in my console app project using visual studio 2010, the project settings are at x86/32bit for this console app because I have to use the ms access driver in it to read in text files using dataTable objects.

the app compiles fine, but when I try to do a initiate the Rensci object it bombs out with unhandled exception :

 Unhandled Exception: System.IO.FileNotFoundException: Could not load file or assembly 'Renci.SshNet, Version=1.0.0.0, Culture=neutral, PublicKeyToken=null' or one of its dependencies. The system cannot find the file specified.File name: 'Renci.SshNet, Version=1.0.0.0, Culture=neutral, PublicKeyToken=null'

 

I have the DLL in the root of the project and added it using rc -> References -> Browse 

 

any ideas?

Sep 18, 2012 at 6:48 PM

well to answer my own question, i'm not sure which fix worked but I :

1) originally I had renamed the .dll to Renci.SshNet.dll file to "Renci.SshNet3.5.dll", so keeping it at its original filename might have fixed it

2) I put the .dll file in the projects bin\Debug folder instead of at the root of the project.

Sep 19, 2012 at 4:34 AM

That was a .Net issue rather than a SSH.NET one. When you run an application, it looks in only a couple of places: the system dll folder, the directory where the exe is located, and a couple others hidden somewhere. Where is doesn't look is the root of your project folder.

You can fix the issue by adding the dll to your project (via Add -> Existing Item), right clicking it -> Properties, and selecting one of the options in "Copy To Output Directory". Then, whenever you build, the dll will be copied over to the output dir (bin/Debug) automatically.