Logo Questions Linux Laravel Mysql Ubuntu Git Menu
 

Library compatibility between C# .NET vs C# Mono

Tags:

c#

mono

I wanted to tryout C# for general purpose programming (not web development). I program in Windows environment, but I would like to avoid coding specifically for Windows (.NET), because I want to keep the option open for a future migration to Linux.

  1. Are there any specific libraries in C# .NET that wouldn't work in C# Mono for general purpose programming work (not interested in Windows Forms, Silverlight and stuff like that) ?

  2. Is there any internet link of things/features that provides a list that works on C# .NET wouldn't work on C# Mono or vice versa? I didn't readily find anything in google per se.

Note: I would be interested in specific answers, not opinions of which is better or worse (thanks!)

like image 201
uday Avatar asked Dec 20 '22 16:12

uday


2 Answers

  1. It is possible for a CLR assembly (even in the form of a DLL, as mentioned in the comments) to be read by Mono, as long as it does not have dependencies that do not exist in Mono, because...
  2. ...not every piece of code that compiles for .NET will compile for Mono, since there are lots of Windows-specific things in .NET (not strictly part of C#) that aren't implemented (WPF, ASP.NET async stack) or don't make sense at all in Linux (COM is one such example, I think).

Fortunately, there is a list of what .NET features are implemented in Mono. Even more fortunately, it seems they have an app that tells you a priori whether your code makes use of anything not implemented in Mono (but I have never tried it).

like image 56
Theodoros Chatzigiannakis Avatar answered Dec 30 '22 08:12

Theodoros Chatzigiannakis


if you install xamarin (you need Pro or bigger so you have VS integration) you can create Portable Class Library that targets xamarin (which is based on mono) and visual studio will allow you to only use classes that are compatible with mono.

http://docs.xamarin.com/guides/cross-platform/application_fundamentals/pcl/introduction_to_portable_class_libraries/

apparently you can also use xamarin studio to create a PCL and there is a free version of that.

like image 32
Z.D. Avatar answered Dec 30 '22 08:12

Z.D.