I've written a C# program on Visual Studio 2015, and I would like to be able to run it on Mac, and possible Linux. Is this possible?
I realise that when compiling a project from Xamarin on Mac, it's exported as a .exe, so would running the .exe compiled on Windows be runnable on Mac?
And if not, how would I make it be?
It doesn't matter if a single .exe can't be cross platform, so long as I can compile for both OS's.
Also, it doesn't matter if it actually is a .exe, so long as it can be run.
Would I be required to actually compile my C# project on a mac?
Asked
Active
Viewed 1,644 times
1

Jacob Garby
- 773
- 7
- 22
-
With **mono** run-time installed on your Mac, you may run exe files generated by Visual Studio. However, you may need to introduce in your c# code some conditional compile directives to adress compatibility issues. – Graffito Dec 24 '16 at 15:43
-
Go to http://dot.net and you will see what's recommended by Microsoft. – Lex Li Dec 25 '16 at 03:06
1 Answers
2
Try to run the exe in Mac by using mono:
/Library/Frameworks/Mono.framework/Versions/Current/bin/mono --runtime=v4.0 [path-to-your-exe]

lowleetak
- 1,362
- 1
- 10
- 19
-
-
-
@JacobGarby test Mono and then you will see how much trouble there can be. Already tons of posts around the internet on compatibility. – Lex Li Dec 25 '16 at 03:05
-
@MrHinsh seriously that's .NET Core, a new platform, not .NET Framework nor Mono. – Lex Li Dec 25 '16 at 03:05
-
And if you write in .NET Core using C# the resultant code will work on any platform: http://stackoverflow.com/questions/37390798/build-exe-file-in-net-core-rc2/37393124 – MrHinsh - Martin Hinshelwood Dec 25 '16 at 17:00
-
@JacobGarby - I strongly suggest that you install Mono on your Windows computer to test/adapt your code to the Mono framework, before further adaptation to Mac environlment. – Graffito Dec 25 '16 at 22:28