Mono Application Compiled Under Linux Does Not Run in Windows
I've been compiling a smallish application in Mono using Gtk#. This is my first Gtk# + Mono application, but I've been developing with the .NET Framework for a decent amount of time now.
The end goal of the application is for it to run under all 3 major platforms (though I only have 2 to test on). So far, I've accomplished that goal kind of.
Sometimes I develop under Linux, other times under Windows. Both systems have Mono 4.0.2 with the latest Gtk#. However, there is a discrepancy between the Linux compiled exe and the Windows compiled exe.
I use the same .sln when compiling, synced via git (GitHub to be exact, if that matters). Specific settings include
I build under Linux: successful build, no errors, runs fine under Linux. File size is 142 kb. This is important. One more thing to note: under Windows, it has no icon (it's the default program icon).
I then build same source, same settings, under Windows: file size is 228kb, has an icon, runs fine.
When I run the Linux built exe, it says "LuaModuleManager.exe has stopped working". the "more details" is this:
Problem signature:
Problem Event Name: CLR20r3
Problem Signature 01: luamodulemanager.exe
Problem Signature 02: 0.7.0.6
Problem Signature 03: 0
Problem Signature 04: LuaModuleManager
Problem Signature 05: 0.7.0.6
Problem Signature 06: 0
Problem Signature 07: f
Problem Signature 08: 13
Problem Signature 09: System.IO.FileNotFoundException
OS Version: 6.1.7601.2.1.0.256.1
Locale ID: 1033
Additional Information 1: 0a9e
Additional Information 2: 0a9e372d3b4ad19135b953a78882e789
Additional Information 3: 0a9e
Additional Information 4: 0a9e372d3b4ad19135b953a78882e789
This is really interesting that it's a System.IO.FileNotFoundException. I can't seem to figure it out for the life of me.
One more thing to note: The Windows compiled exe runs fine in Windows and Linux, but the Linux compiled exe only runs in Linux. And causes the "LuaModuleManager.exe has stopped working" error.
So what could be the issue? Booting into a Windows VM (or rebooting my whole system to get to my Windows installation) is a bit of an inconvienence just to compile and push out a new build of a program.
Since you are using Mono.Unix.Catalog then your project should be referencing the Mono.Posix assembly.
The problem is likely to be that on Windows only Mono.Posix 2.0.0.0 is installed with GTK# 2.12.
On Linux you will have both Mono.Posix 2.0.0.0 and 4.0.0.0 and when you compile a .NET 4 project with xbuild on Linux it will use Mono.Posix 4.0.0.0, which is compiled against .NET 4.0, instead of Mono.Posix 2.0.0.0 which is compiled against .NET 2.0.
There is an open bug about this problem.
Ideally the GTK# installer for Windows would include Mono.Posix 4.0.0.0 but currently it does not.
链接地址: http://www.djcxy.com/p/90104.html