开发者

Run C# executable from command line and specify path to libraries needed

I am running a C# executable which was built with a reference to a .Net library. The .NetLibrary is a wrapper around a C++ library, which resides in another folder (separate folder from the .NetLibrary).

The C++ library is in /usr/local bin The .Net library is in /pr开发者_Go百科ojects/csharp/NetWrapperProj/bin/Debug The executable is in /projects/csharp/testharness/bin/Debug

As you may have guessed from the paths, I am running .Net using mono on Linux (Ubuntu 10.0.4). mono version 2.10.

How may I specify the required binaries to the executable - to avoid Unhandled Exception: System.IO.FileNotFoundException type exceptions being thrown?


Normally, the DLLs/Libraries need to be in the same directory as the executable. From the Mono website:

If a library location has not been explicitly specified in a DllMap entry in an application or assembly .config file, Mono will search for a library in a few places:

  • The directory where the referencing image was loaded from.
  • In any place the system's dynamic loader is configured to look for shared libraries. For example on Linux this is specified in the $LD_LIBRARY_PATH environment variable and the /etc/ld.so.conf file. On windows the $PATH environment variable is used, instead.

You can read more at the Mono website on how to remedy this problem.

0

上一篇:

下一篇:

精彩评论

暂无评论...
验证码 换一张
取 消

最新问答

问答排行榜