2

I have created a c# application in ubuntu using monodevelop. It is running well in ubuntu. I tried to run that application(firstgtk.exe file created after running in ubuntu)in windows.But it showing error message.How can i make to portable in both linux and windows?

The error message is:

when i click the firstgtk.exe file, a command prompt has come.It is blank. At the same moment microsoft message(send Error report or don't send):

firstgtk has encountered a problem and needs to close.

When i click don't send button, command prompt and message box are gone.

2
  • 1
    Please include the actual error message as part of your question. Commented Jul 15, 2010 at 17:23
  • Show us the error message and we can help you better. Other than that I'm guessing... Do you have Mono installed on the Windows environment? You might have to compile the Windows version under windows, unless the dev tool you're using can target Windows from Linux. Commented Jul 15, 2010 at 17:25

3 Answers 3

4

Mono compiles down to CIL code and is completely portable to .NET or Mono on other platforms. I can compile my C# code on a Mac and run the resulting EXE on Linux or Windows under either .NET or Mono.

Without the actual error message we can only guess the issue here. That said, in my experience, the most common reasons an application written in Mono on Linux/UNIX would create an error on Windows are pathnames with platform specific path separators or case sensitivity issues. The Windows file system is not case sensitive but they are on Linux/UNIX.

Another possibility is that you are using Mono on one platform and trying to run it on .NET on the other. Mono ships with a number of libraries that are not present in .NET on Windows.

Actually, I guess a final possibility is that GTK# is a common way to produce GUI code on Mono. GTK# relies on the GTK+ C library being present which is very common on Linux but unlikely on Windows unless it has been explicitly installed.

We really need to know what the error message was.

Sign up to request clarification or add additional context in comments.

1 Comment

Now that more info has been added, I can see that my last guess was correct. Anthony jumped in with the right answer above. GTK# has to be installed.
1

If you're using Gtk#, your app is portable between Windows and Linux. My guess is that you don't have Gtk# installed correctly (or at all?) on Windows. You can download from here. As of this time the latest version is 2.12.10.

2 Comments

Thanks, it is working. I have created another simple java console project.While double clicking it's exe file,same type of error is coming.Any thing i need to install?
I was going to say "Good guess Anthony" but I see the question was updated to provide more info. So, instead I will say "Good answer". :-)
1

Your code should be portable between Linux and Windows. Alas, the binaries are not. ...

Edit: As commenters have pointed out, Mono does produce and use PE executables, though other issues may limit portability.

7 Comments

Won't he need to have Mono installed on Windows before he can compile for Mono on Windows?
I don't think this is true. Mono produces PE files which the mono runtime loads and executes. I believe the same binary works on both platforms.
@codekaizen: Yeah? Cool. But in that case he'd still need the Mono platform on Windows. It's not even clear if he has that.
@codekaizen: I looked through the Mono FAQ, and it appears that "100% .NET" apps generated by MS tools are binary compatible to be run under Mono/Linux. It doesn't mention anything about binaries generated by Mono/Linux being natively usable under Windows. Maybe it's a compile time flag?
You don't have to have the Mono framework installed on Windows if you don't want to. The same binaries will run on Mono for Linux, Mono for Windows, Mono for OSX, or .Net on Windows.
|

Your Answer

By clicking “Post Your Answer”, you agree to our terms of service and acknowledge you have read our privacy policy.

Start asking to get answers

Find the answer to your question by asking.

Ask question

Explore related questions

See similar questions with these tags.