tags:

views:

264

answers:

3

My question is similar to this one and this one, but there is a slight difference. So that's why I am asking it here.

I have a shiny .Net 3.5 Windows Service ( with NHibernate, LINQ, lambda expression) etc, running on Windows. Now I plan to port my app to Linux, so I am thinking about Mono.

Can I just compile my .net app in Windows, and copy it to a Linux machine with .Net ( mono version) installed, and expect it to run smoothly? If not, is there anything I should do?

Any answers or pointers are welcome.

+6  A: 

Start by using the MoMA tool

The Mono Migration Analyzer (MoMA) tool helps you identify issues you may have when porting your .Net application to Mono. It helps pinpoint platform specific calls (P/Invoke) and areas that are not yet supported by the Mono project. While MoMA can help show potential issues, there are many complex factors that cannot be covered by a simple tool. MoMA may fail to point out areas that will cause problems, and may point out areas which will not actually be an issue

From Personal point: All C# 3.0 feature are supported well, I had no problem with LINQ (To Objects, don't know about LINQ to SQL or to XML) and NHiberinate also works well (although I didn't end up using in)

Shay Erlichmen
+2  A: 

The runtime should be fine but you can run the Mono Migration Analyzer.

+6  A: 

Will it just work? You really have to test it. I've just recently put effort into making Protocol Buffers work on Mono. I've had very little execution-time trouble so far; the compiler was more of an issue for me. However, I've had to temporarily disable one of the unit tests (using mocking) because it makes the Mono 2.4 VM itself go bang. I haven't investigated why yet, but that sort of thing is basically impossible to predict.

Anything which uses "deep" aspects of the CLR - such as expression trees and dynamic methods - is likely to have more problems than simple libraries, IMO.

Now, you say it's a Windows service - obviously Linux doesn't have services in quite the same way as Windows, so you'll need to work out how you want it to run. I'd start off by running it as a simple console app if I were you... once it's all working, you can think about integrating it with other "service" controllers etc - if you find you need to.

It certainly used to be the case that xbuild didn't provide a seamless migration path from building on Windows to building on Linux... however, it's had a lot of attention recently, so it's worth trying again...

Jon Skeet
Wow, so you actually ran the tests in Mono? Did you compile your code and tests in mono, as well?
Ngu Soon Hui
Yes, everything now builds in mono - but I had to work round a few issues with the compiler, and the "build system" is just a shell script with liberal use of `find . -name '*.cs`. You should *definitely* run your unit tests under Mono... but that's just the first step, of course. You'll need to test the whole app manually too.
Jon Skeet
Interestingly, I submitted a good number of mono compiler bugs while doing protobuf-net... still has some kinks to work out, obviously.
Marc Gravell
@Marc: My latest one is a real edge case - https://bugzilla.novell.com/show_bug.cgi?id=516379
Jon Skeet
(Darn, now noticed I made a typo in the description. Ah well.)
Jon Skeet
I guess that you need to update your answer xbuild has mature really well over the pass months.
Shay Erlichmen
@Shay: Will do :)
Jon Skeet