我正在构建一个面向.NET 4.0的简单应用程序。这是我正在使用Visual Studio 2010构建的POC,并在Raspbian的Mono上运行它。
我已经过了Hello World阶段,现在我添加了第三方Matrix XMPP SDK。该应用程序在Windows中完全正常。
所以我将文件复制到Raspbian并运行mono SampleForm.exe
。它不会运行并提供异常,因此我使用--debug
标志运行它,部分调试日志如下所示。 (Full log)
Mono: The request to load the assembly System.Xml.Linq v3.5.0.0 was remapped to v4.0.0.0
Mono: Assembly Loader probing location: '/usr/lib/mono/gac/System.Xml.Linq/4.0.0.0__b77a5c561934e089/System.Xml.Linq.dll'.
Mono: Assembly Loader probing location: '/mnt/win/System.Xml.Linq.dll'.
Mono: Assembly Loader probing location: '/usr/lib/System.Xml.Linq.dll'.
Mono: Assembly Loader probing location: '/usr/lib/mono/4.5/Facades/System.Xml.Linq.dll'.
Mono: Assembly Loader probing location: '/usr/lib/mono/gac/System.Xml.Linq/4.0.0.0__b77a5c561934e089/System.Xml.Linq.exe'.
Mono: Assembly Loader probing location: '/mnt/win/System.Xml.Linq.exe'.
Mono: Assembly Loader probing location: '/usr/lib/System.Xml.Linq.exe'.
Mono: Assembly Loader probing location: '/usr/lib/mono/4.5/Facades/System.Xml.Linq.exe'.
Mono: The following assembly referenced from /mnt/win/Matrix.dll could not be loaded:
Assembly: System.Xml.Linq (assemblyref_index=1)
Version: 3.5.0.0
Public Key: b77a5c561934e089
The assembly was not found in the Global Assembly Cache, a path listed in the MONO_PATH environment variable, or in the location of the executing assembly (/mnt/win/).
Mono: Failed to load assembly Matrix[0x15c30b0]
Mono: Could not load file or assembly 'System.Xml.Linq, Version=3.5.0.0, Culture=neutral, PublicKeyToken=b77a5c561934e089' or one of its dependencies.
Mono: Could not load file or assembly 'System.Xml.Linq, Version=3.5.0.0, Culture=neutral, PublicKeyToken=b77a5c561934e089' or one of its dependencies.
Mono: Could not load file or assembly 'System.Xml.Linq, Version=3.5.0.0, Culture=neutral, PublicKeyToken=b77a5c561934e089' or one of its dependencies.
Mono: Could not load file or assembly 'System.Xml.Linq, Version=3.5.0.0, Culture=neutral, PublicKeyToken=b77a5c561934e089' or one of its dependencies.
Mono: Could not load file or assembly 'System.Xml.Linq, Version=3.5.0.0, Culture=neutral, PublicKeyToken=b77a5c561934e089' or one of its dependencies.
System.TypeLoadException: Could not load type 'Matrix.Xmpp.Client.XmppClient' from assembly 'Matrix, Version=1.5.3.0, Culture=neutral, PublicKeyToken=41a432ad608f2ff0'.
at XMPPHandler.DotNetXMPPClient..ctor () [0x00000] in <filename unknown>:0
我试图解决的问题:
编译.NET 3.5。但是,这导致了更多错误,甚至没有出现Win Form。
我尝试过进行绑定重定向但是没有用。
<runtime>
<assemblyBinding xmlns="urn:schemas-microsoft-com:asm.v1">
<dependentAssembly>
<assemblyIdentity name="System.Xml.Linq" publicKeyToken="b77a5c561934e089" />
<bindingRedirect oldVersion="3.5.0.0" newVersion="4.0.0.0"/>
</dependentAssembly>
</assemblyBinding>
</runtime>
我尝试将3.5版本的System.Xml.Linq放入我的VS项目中,但它会自动将其更改回4.0
我试着找一种方法为System.Xml.Linq安装v.4.0.0,发现sudo apt-get install mono-data
应该这样做,但我被告知没有找到包(即使在apt之后) -获取更新)。我检查了/usr/lib/mono/gac/System.Xml.Linq
目录,只有目录3.5.0.0__b77a5c561934e089
存在。
我安装了libmono-system-xml-linq4.0-cil,然后运行了应用程序。现在我遇到了分段错误。
如何安装版本4.0.0.0或者我还能做些什么来使它工作?
答案 0 :(得分:0)
我在Debian上使用mono 3.6(=从源代码编译的非常新版本)并使System.Xml.Linq工作。我遇到的唯一问题是System.Xml.Linq.dll是本地复制的。
答案 1 :(得分:0)
当您的Mono没有安装一些dotnet库时,通常会发生这种问题。您需要为Mono(在Raspbian上)安装donet系统xml lib:
apt-get install libmono-system-xml-linq4.0-cil
我的情况下,我需要手动安装其中一些库。对于Raspbian,我安装了以下库:
apt-get install libmono-system-xml-linq4.0-cil
apt-get install libmono-system-web-extensions4.0-cil
如果由于未找到其他库而无法在Mono下运行应用程序,则可以查看Mono here的所有可用库。