views:

158

answers:

2

I really want to write .NET apps that run on any platform (PC, Linux and Mac). I am not really concerned about UI capabilities because these are mostly background services. I have heard of MONO and that it allows you to write .NET apps that run on Mac and Linux, but I want to be able to write a single app that when compiled for Windows will run as a Service, and when compiled for Linux will run as whatever the UNIX equivalent is. I also would like to be able to store things in the registry and have that work. Is there any way to write truly OS agnostic code like this? ...and DON'T say I should make it run on the web! :)

+1  A: 

Short answer: no. You could create an application which will run on both Windows and Linux. But there are platform-specific features and right now Mono could not automatically 'translate' those for you. A Windows Service is a good example of that.

Ilya Kochetov
+7  A: 

Yes, Mono has the windows service stuff ported to Linux, but you are going to have to think of a better way to store configuration settings than Registry... Using XML files for instance would be cross platform.

You should also check out mono's wiki on how to develop portable applications here.

sontek
I had not seen mono-service. Very cool. It is worth mentioning that mono doesn't require a recompile with mono and will run the binaries produced by visual studio though.
Hamish Smith