我正在尝试将用C#编写的.NET应用程序移植到linux中。
使用MoMa工具进行的兼容性测试表明该应用程序兼容。
我使用Visual Studio 2010编译了代码,然后将生成的.exe文件复制到了我的Ubuntu VM(运行10.04 LTS)。
我已经安装了badgerport源代码的单声道(来自http://badgerports.org/lucid.html)。我看到我在/ usr / lib / mono目录中有4.0库:
user@ubuntu:~$ ls -l /usr/lib/mono
total 52
drwxr-xr-x 3 root root 4096 2012-08-27 07:15 2.0
drwxr-xr-x 3 root root 4096 2012-08-27 07:15 3.5
drwxr-xr-x 3 root root 12288 2012-08-27 07:15 4.0
drwxr-xr-x 2 root root 4096 2012-08-27 07:14 compat-2.0
drwxr-xr-x 145 root root 12288 2012-08-27 07:15 gac
drwxr-xr-x 3 root root 4096 2012-08-27 07:15 mono-configuration-crypto
drwxr-xr-x 2 root root 4096 2012-08-27 07:15 monodoc
drwxr-xr-x 3 root root 4096 2012-08-27 07:15 xbuild
drwxr-xr-x 3 root root 4096 2012-08-27 07:15 xbuild-frameworks
当我查看mono的手册页时,我会在顶部看到Mono 2.5。
mono -V返回以下内容。
user@ubuntu:~$ mono -V
Mono JIT compiler version 2.10.8.1 (Debian 2.10.8.1-1~dhx1~lucid1)
Copyright (C) 2002-2011 Novell, Inc, Xamarin, Inc and Contributors. www.mono-project.com
TLS: __thread
SIGSEGV: altstack
Notifications: epoll
Architecture: x86
Disabled: none
Misc: softdebug
LLVM: supported, not enabled.
GC: Included Boehm (with typed GC and Parallel Mark)
这是我尝试运行该应用程序时的输出。
user@ubuntu:~$ mono MyApplication.exe
Unhandled Exception: System.TypeLoadException: A type load exception has occurred.
at MyApplication.ConsoleRunner..ctor () [0x00000] in <filename unknown>:0
at MyApplication.Program.Main (System.String[] args) [0x00000] in <filename unknown>:0
[ERROR] FATAL UNHANDLED EXCEPTION: System.TypeLoadException: A type load exception has occurred.
at MyApplication.ConsoleRunner..ctor () [0x00000] in <filename unknown>:0
at MyApplication.Program.Main (System.String[] args) [0x00000] in <filename unknown>:0
对正在发生的事情有什么见解,以及我可以做些什么来解决?不幸的是,由于其他开发限制,我只能使用Ubuntu 10.04。
最佳答案
您绝对不必使用Mono编译器进行编译,至少不必设计使然。尝试使用MONO_LOG_LEVEL="debug" mono your_software.exe
运行,您会发现尝试查找程序集和其他可能有用的信息。并放在这里;)
关于c# - 使用来自badgerports的Mono软件包,在运行时获取异常,我们在Stack Overflow上找到一个类似的问题:https://stackoverflow.com/questions/12143935/