我在openSUSE 12.1上运行mono 2.10.6。不应该在/usr/lib/mono/4.0或/usr/lib/mono/2.0中有System.Data.dll吗?
我正在测试在windows上编译的.NET应用程序。该应用程序引用了automapper,当我尝试运行该应用程序时出现以下错误:
Unhandled Exception: System.TypeInitializationException: An exception
was thrown by the type initializer for AutoMapper.Mappers.DataReaderMapper --->
System.IO.FileNotFoundException: Could not load file or assembly 'System.Data,
Version=4.0.0.0, Culture=neutral, PublicKeyToken=b77a5c561934e089' or one of its
dependencies.
File name: 'System.Data, Version=4.0.0.0, Culture=neutral,
PublicKeyToken=b77a5c561934e089'
这是mono --version的输出:
linux-19xt:~ # mono --version
Mono JIT compiler version 2.10.6 (tarball Sat Oct 29 18:16:09 UTC 2011)
Copyright (C) 2002-2011 Novell, Inc, Xamarin, Inc and Contributors. www.mono-project.com
TLS: __thread
SIGSEGV: altstack
Notifications: epoll
Architecture: amd64
Disabled: none
Misc: debugger softdebug
LLVM: supported, not enabled.
GC: Included Boehm (with typed GC and Parallel Mark)
答案 0 :(得分:0)
Mono的程序集与Microsoft不具有相同的PublicKeyToken,因为Microsoft不会与Mono团队共享密钥,因此您需要配置AutoMapper以忽略PublicKeyToken。
但是,我不确定AutoMapper是否可以配置为与Mono配合使用,因为在任何地方都没有官方声明,并且GitHub上存在问题,
https://github.com/AutoMapper/AutoMapper/issues/217
还有一个邮件主题,
http://groups.google.com/group/automapper-users/browse_thread/thread/773193330f7d12ef?pli=1
答案 1 :(得分:0)
安装" mono-complete"或" monodevelop"你不应该再看到这个问题。在unbuntu上命令是......
sudo apt-get install mono-complete
或monodevelop ide(也安装mono-complete)
sudo apt-get install monodevelop
我有3个vms(1个只安装了单声道运行时,1个安装了monodevelop ide,1个安装了mono-complete)都运行完全相同的可执行文件,但只有一个看到你描述的问题就是那个只安装了mono运行时。运行" mono-complete"以上命令解决了这个问题。