views:

195

answers:

2

I know that binaries built in Windows don't need to be recompiled for linux machines with Mono. Does it work the other way around? Are binaries built with Mono on linux machines runnable on Windows with just the .NET Framework?

+2  A: 

Don't forget that the a .NET binary file (exe or dll) contains platform independent IL code.

Therefore a binary built with Mono on linux can be run on Windows as long as it includes the standard portable executable (PE) header information. All other code inside the binary is platform independent IL.

For a practical way to see this in action try installing MonoDevelop on a Linux box and then build a simple test project.

After building the project, locate the Debug directory. It contains the exe file that can be copied directly to windows and run.

Ash
+4  A: 

Yes - the file format is portable between Mono and .NET. Of course, that's barring bugs in the implementation, which isn't an impossibility.

The file format is even documented in ECMA-335, partition 2, section 25.

Obviously you'll need any assemblies that your app references. I believe that even P/Invoke can be portable, if you've got the same native library name exposing the same functions.

Jon Skeet