使用Mono.TextEditor程序集来创建自己的文本编辑器

时间:2013-02-24 21:02:10

标签: mono monodevelop text-editor

我正在尝试使用uontu 12.04中的MonoDeveloper v:3.0.3.2中的Mono.Texteditor.dll创建自己的文本编辑器。我把我的代码简化为最简单的例子,我似乎无法让它工作。我一直收到这个错误。

Unhandled Exception: System.IO.FileNotFoundException: Could not load file or assembly
'Mono.TextEditor, Version=1.0.0.0, Culture=neutral, PublicKeyToken=null' or one of 
its dependencies. File name: 'Mono.TextEditor, Version=1.0.0.0, Culture=neutral,
PublicKeyToken=null' at CVXmlEditor.MainClass.Main (System.String[] args) [0x00000]
in <filename unknown>:0 

我知道它已安装,我在那里添加了作为我的项目的参考。

我的代码很简单,如下:

using System;
using Gtk;
using Mono.TextEditor;

public partial class MainWindow: Gtk.Window
{
 public MainWindow (): base (Gtk.WindowType.Toplevel)
 {
    Build ();

    TextEditor te = new TextEditor();
 }

 protected void OnDeleteEvent (object sender, DeleteEventArgs a)
 {
    Application.Quit ();
    a.RetVal = true;
 }
}

当到达构造文本编辑器的行时,即使编译好,它也会抛出。任何想法?

以下是调试级别日志的输出。

Mono: The following assembly referenced from /home/bryan/Work/CVXmlEditor/TestMonoEditor/TestMonoEditor/bin/Debug/TestMonoEditor.exe could not be loaded:
 Assembly:   Mono.TextEditor    (assemblyref_index=2)
 Version:    1.0.0.0
 Public Key: (none)
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 (/home/bryan/Work/CVXmlEditor/TestMonoEditor/TestMonoEditor/bin/Debug/).

Mono: Failed to load assembly TestMonoEditor[0xf55400]

Mono: Could not load file or assembly 'Mono.TextEditor, Version=1.0.0.0, Culture=neutral, PublicKeyToken=null' or one of its dependencies.
The application was terminated by a signal: SIGHUP

1 个答案:

答案 0 :(得分:0)

不要使用MonoDevelop 3.x代码,因为MonoDevelop 4.0刚刚发布,它会带来一些API中断更改。所以我建议你使用monodevelop master分支以防万一。

完成后,如果仍然遇到该异常,我想知道您是否将Mono.TextEditor dll放在与可执行文件相同的文件夹中?如果是,那么尝试调整这里解释的一些环境变量(http://www.mono-project.com/Logging_Runtime_Events)以试图了解加载器如何找不到你的程序集。

此外,这是什么版本的单声道?