我正在尝试使用在Linux(单声道)上运行的使用awesomium(仅限控制台)的C#开发的程序。
我已经下载并安装了最新的Awesomium SDK 1.7.5。
# ldconfig -p | grep libawe
libawesomium-1-7.so.5 (libc6,x86-64) => /usr/lib/libawesomium-1-7.so.5
在我的解决方案中,我已经包含了对Awesomium.Mono.dll的引用。 在Awesomium.Mono.dll.config文件中,我已经为linux操作系统重新定位了dllmap ..也许这不是必需的?
<?xml version="1.0" encoding="UTF-8" ?>
<configuration>
<!-- Fix the target below to target the Awesomium native library -->
<dllmap dll="awesomium" target="libawesomium-1-7.so.5" os="linux"/>
<dllmap dll="awesomium" target="@executable_path/../Frameworks/Awesomium.framework/Versions/A/Awesomium" os="osx"/>
</configuration>
我目前收到错误,指出无法找到dll
Unhandled Exception: System.TypeInitializationException: An exception was thrown by the type initializer for Awesomium.Core.WebCore ---> System.TypeInitializationException: An exception was thrown by the type initializer for Awesomium.Core.NativeMethods ---> System.TypeInitializationException: An exception was thrown by the type initializer for AweExceptionHelper ---> System.DllNotFoundException: libawesomium-1-7.so.5
at (wrapper managed-to-native) Awesomium.Core.NativeMethods/AweExceptionHelper:RegisterExceptionCallbacks_awesomium (Awesomium.Core.NativeMethods/AweExceptionHelper/ExceptionDelegate,Awesomium.Core.NativeMethods/AweExceptionHelper/ExceptionDelegate,Awesomium.Core.NativeMethods/AweExceptionHelper/ExceptionDelegate,Awesomium.Core.NativeMethods/AweExceptionHelper/ExceptionDelegate,Awesomium.Core.NativeMethods/AweExceptionHelper/ExceptionDelegate,Awesomium.Core.NativeMethods/AweExceptionHelper/ExceptionDelegate,Awesomium.Core.NativeMethods/AweExceptionHelper/ExceptionDelegate,Awesomium.Core.NativeMethods/AweExceptionHelper/ExceptionDelegate,Awesomium.Core.NativeMethods/AweExceptionHelper/ExceptionDelegate,Awesomium.Core.NativeMethods/AweExceptionHelper/ExceptionDelegate,Awesomium.Core.NativeMethods/AweExceptionHelper/ExceptionDelegate)
有什么建议吗?
答案 0 :(得分:1)
这就是我让Awesomium在Linux上使用Mono工作的方式:
下载并安装(在Windows上)适用于Windows的Awesomium SDK(awesomium_1_7_5_1_sdk_win
)。
查找Awesomium.Mono.dll
(对我而言C:\Program Files\Awesomium Technologies LLC\Awesomium SDK\1.7.5.1\wrappers\Awesomium.NET\Assemblies
),复制到Linux并在Mono项目中引用,确保选中Local Copy
。
下载适用于Linux的Awesomium SDK(awesomium_1_7_5_sdk_linux64
)并摘录。
将bin
的内容复制到项目的操作目录(例如bin/Debug
)。
将libawesomium-1-7.so.5.0
重命名为libawesomium-1-7.so.0.0
。
示例代码(从文档中修复的拼写错误):
using System;
using Awesomium.Core;
class MainClass
{
public static void Main (string[] args)
{
using (var webView = WebCore.CreateWebView( 800, 600 ) )
{
webView.Source = new Uri( "http://www.google.com" );
webView.LoadingFrameComplete += ( s, e ) =>
{
if (!e.IsMainFrame)
return;
BitmapSurface surface = (BitmapSurface)webView.Surface;
surface.SaveToPNG ("result.png", true);
WebCore.Shutdown ();
};
}
WebCore.Run();
}
}