EDIT (the whole question, it was too unclear)
I want to use OpenSSL.NET
The OpenSSL.NET install instructions page: INSTALL
The .NET way of doing this is to install your assembly in the global assembly cache.
Each computer where the common language runtime is installed has a machine-wide code cache called the global assembly cache. The global assembly cache stores assemblies specifically designated to be shared by several applications on the computer.
Try changing the Platform target for your project to x86 instead of "any cpu".
As a last resort, if nothing else works:
It may be useful to know where the application (.net or not) is looking for the DLLs. Just use Process Monitor and filter for the file name of the DLL. Then copy it to a location where the application is looking for it.
In my case, when we develop a web site with open ssl on x64 win 2008 platforms, we must check with application pool : allow 32 applications : true
Create New Folder Named x86 in your application path and then put libeay32.dll,ssleay32.dll in x86 folder.
Try using probing. You need to create an XML config file named as the application's executable complete name (or named as the assembly that requieres your non-managed dll) with a .config extension. E.g. if your applications is name myapp.exe, the config file will be named myapp.exe.config The config file must be located in the same directory as the executable / assembly .
The config file is a simple xml file:
<?xml version="1.0" encoding="utf-8" ?>
<configuration>
<runtime>
<assemblyuBinding xmlns="urn:schemas-microsoft-com:asm.v1">
<probing privatePath="PATH" />
</assemblyuBinding>
</runtime>
</configuration>
Now the application will search in PATH when loading the assemblies. PATH is relative to the config /assembly file.
Not sure if it will work for non-managed dlls, but is worth the try.