我在MonoDevleop和GTK#中编写了一个程序。通过MonoDevelop运行程序不会产生任何问题,但是如果我尝试在MD之外运行程序(通过打包Windows Release x86的二进制文件),我会得到这个:
Problem Event Name: CLR20r3
Problem Signature 01: areatest.exe
Problem Signature 02: 1.0.4500.36382
Problem Signature 03: 4f9b440c
Problem Signature 04: glib-sharp
Problem Signature 05: 2.12.0.0
Problem Signature 06: 4a1c33d2
Problem Signature 07: 2b8
Problem Signature 08: 0
Problem Signature 09: System.DllNotFoundException
OS Version: 6.1.7601.2.1.0.256.1
Locale ID: 1033
Additional Information 1: 0bff
Additional Information 2: 0bff8d176610735333c3986b545525d3
Additional Information 3: b571
Additional Information 4: b571ae7bc62750b34b3b738a0a557539
我用谷歌搜索了CLR20r3,发现很少有人处理它。我已经尝试卸载所有Mono相关的东西(MonoDevelop,Gtk#for .NET,Mono for Windows,Gtk#和XSP安装程序)并重新安装它,我在找出正在发生的事情方面取得了一些进展。我的解决方案中引用了Glib-sharp。我尝试在Visual C#2010中打开解决方案并获得2个警告:
Warning 2 The referenced component 'Mono.CSharp' could not be found.
Warning 1 Could not resolve this reference. Could not locate the assembly "Mono.CSharp". Check to make sure the assembly exists on disk. If this reference is required by your code, you may get compilation errors.
我引用了Mono.CSharp并没有消除警告。无论如何我运行了程序,并在我的主程序中抛出异常:
class MainClass {
public static void Main (string[] args)
{
Application.Init (); // here
MainWindow win = new MainWindow ();
win.Show ();
Application.Run ();
}
}
如果我发布了该程序,.exe仍然存在同样的问题。
我想要做的是让程序在任何操作系统上运行。对于Windows,我被告知我的用户不必安装Mono,只需安装.NET 4,但是当我尝试正常运行时,它会给出上面列出的崩溃报告。让我的程序运行我发现的唯一方法是通过调用
mono AreaTest.exe
在命令提示符下。如果在Windows上运行.NET 4和Mac / Linux上的Mono,我该怎么做才能使程序在我和他人的计算机上运行?