0

我在 openSUSE 12.1 上运行单声道 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)
4

2 回答 2

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

于 2012-06-11T08:37:09.123 回答
0

安装“mono-complete”或“monodevelop”,您应该不会再看到这个问题。在 unbuntu 上,命令是...

sudo apt-get install mono-complete

或者对于monodevelop ide(也安装了mono-complete)

sudo apt-get install monodevelop

我有 3 个虚拟机(1 个仅安装了 mono 运行时,1 个安装了 monodevelop ide,1 个安装了 mono-complete)都运行完全相同的可执行文件,但只有一个看到您描述的问题的是只有 mono运行时安装。运行上面的“mono-complete”命令解决了这个问题。

于 2013-01-03T17:15:48.407 回答