Dear All,
Can we run Microsoft Visual C# executable within linux and mac ? Or do we need something to be able to do that. I am new in C#, I was just wondering is C# like java that can be run in any operating systems.
Kindest Regards,
E
blah blah blah is here! blah blah » Close
2 answers
The Microsoft Visual C# compiler will only produce executables that run on Windows.
To run your applications on Linux or Mac OS, you'll need to recompile them first using the open source Mono C# compiler and install their version of the .NET Framework redistributable on the client machine.
Mono C# and their versions of the CLR and the basic framework are compatible with the Microsoft offerings, given that both are based on international standards.
They also have a version of Silverlight, known as Moonlight.
However, this doesn't mean that applications of any size written in Visual C# will automatically compile and run on Linux or Mac OS. They probably won't because of differences between the operating systems but you should be more than 90% of the way there.
So, the situation is a bit like the old Java joke - write once, debug everywhere :)
EDIT
Although I'd always thought that you'd need to recompile Visual C# applications before you could run them under Mono, I found out today that this may not be strictly necessary, regardless of the operating system.
This is because Mono uses the same 'Portable Executable' file format as Visual C# and is therefore binary compatible with it.
So simple applications should run 'as is'.
However, if the application contains anything which is incompatible with Mono (see the site for details), you will need to recompile after making the necessary changes.
answered one year ago by:
17279
301
So I have to recompile them first? Can I do this automatically (like using a makefile) or can I compile them using Mono in windows and just redistribute to other os?
17279
Actually it may not be necessary to recompile (see my edit). So you could try downloading Mono to a Linux machine, upload your VC# executable to that machine and see if it will run. If it won't run without errors, then I'd try uploading the whole Visual Studio solution and see if it can be opened and edited in MonoDevelop - this should be possible for VS 2005 but I'm not sure about VS 2008 or 2010 solutions.
hello, you need the .Net framework in order to run any .net application. So if you have a .net framework on the other OS then you'll be able to run it. i think you can run it on mac but i'm not sure coz what i heard is that you can run silverlight on mac. so google .net framework on linux or mac.
answered one year ago by:
1556