Understanding Moonlight; Is it a framework? - moonlight

I'm trying to understand if moonlight is a framework which is similar yet independent to the mono framework in exactly the same way as silverlight is similar yet independent for dot net framework.
I'm trying to write a library that works for both moonlight and mono and I was wondering if I would need to target specific frameworks (as is the case with silverlight and dot net).

Moonlight uses the Mono runtime but, like Silverlight, uses a subset of the available .NET framework. So yes, you'll need to target different frameworks for desktop vs Moonlight (Moonlight uses the 2.1 profile, same as Silverlight).

Related

Can I use a .net 5 library with a .net 6 application?

I have an application that we are going to upgrade from .net framework 4.6 to .net 6.
However one class library has to be run in .net 5 because of limitations in a Linux version that we have to use.
So I wonder if it is possible to use the .net 5 library with .net 6?
I tested experimentally on a simple case. The .NET6 app referencing .NET5 library could be built without any warnings or errors and ran without runtime problems:
Some related quotes from Microsoft Docs:
If you're using libraries to break down an application into several components, we recommend you target net5.0 or net6.0. For simplicity, it's best to keep all projects that make up your application on the same version of .NET. Then you can assume the same BCL features everywhere. (...)
To me, this sounds like a good practice to have everything on the same version (5 or 6), but not like a strong requirement.
I'm not 100% confident about edge cases, however. I couldn't find any confirmation of compatibility. At the moment, I would hesitate running a complex production app built from components mixing 5 and 6.

Is it possible to create native Android and iOS library with Xamarin? [duplicate]

Currently, we are developing a .NET Standard class library that will be used by different Xamarin.* platforms.
I was wondering if there is a way to use the shared code in a native Android project (maybe produce an AAR/JAR file).
The reason I need this functionality is because our company provides an AAR to one of our customers (that is used by a native Android project), and we would like to keep a single source base instead of two.
Thanks in advance!
Update:
The name changed to ".NET Embedding" and it is at v0.4 at the time of this update.
https://developer.xamarin.com/releases/dotnetembedding/dotnetembedding_0/dotnetembedding_0.4/
New instructions:
Installing .NET Embedding
Original post:
You can use Mono's Embeddinator-4000
It supports various language consumers, so it surfaces .NET code as idiomatic code in the target language. This is the list of supported languages at present:
Objective-C: mapping .NET to idiomatic Objective-C APIs.
Java: mapping .NET to idiomatic Java APIs.
C: mapping .NET to an object-oriented like C APIs.
Embeddinator-4000 is a tool that allows your existing .NET Code (C#, F# and others) to be consumed from other programming languages and in various different environments.
Java is currently in a preview state for macOS, Windows, and Android.
The platform is selected by passing the --platform= command-line argument to the embeddinator. Currently macOS, Windows, and Android are supported.
re: https://mono.github.io/Embeddinator-4000/
As a part of the requires For Android you will need Xamarin.Android 7.4.99+ and Android Studio 3+ (Java 1.8) but if you are building Android apps with Xamarin and Java you would have those already.
Note: This tool is in Preview, so review the open issues and post new if needed.
re: https://github.com/mono/Embeddinator-4000/issues
Note: This is not trans-compiling, but embedding Mono's runtime in a native package that allow CIL code, AOT'd (i.e. iOS) or not to run within a different language/runtime.

Xamarin Cross Platform Development .net

We are developing a cross platform mobile application using Xamarin. I have noticed there are different ways of structuring your code using Shared code or PCL/.net standard.
I attempted to use .net standard and what i have found is that it doesn't include all the libraries such as using ado stuff , datatable/datasets using system.data. Or using system.net for example. Other functions have less overloads and seems that its a stripped version of .net to work across platforms. Is there any way to add this functionality or use a broader range of .net?
You are correct - .Net Standard and .Net Core are stripped down versions of the full .Net framework. They contain only features that can be used on all platforms (Mac, Android, iOS, Linux, Windows, etc.)
The full .Net framework only needs to work on Windows, so there are additional things that you can do based on the fact that there is less complexity in implementing and that the code base is more mature (cross platform is still pretty new by C# standards). To the best of my memory, System.Net should work if you have your references correct, but System.Data will not (or at least direct database access is not possible)
You can regain some functionality through NuGet packages, but it won't be the same as using WinForms or something like that...
My best advice would be to program against an API. You can use a web server that runs on the normal (full) .Net framework, and does all the heavy lifting using all the .Net features that you are accustomed to. Your Xamarin app would send and receive data from the API and basically provide a mobile front end for whatever you are doing. This approach makes sense for most apps anyway, and is generally what you would be doing anyway if you used Swift and Java to create separate iOS and Android apps.

Mono - Native UI on each platform?

Is it possible to have one core dll written in mono and 3 separated native UIs on Linux, Mac and Windows? If yes, what are the options I have?
Let's assume I have written a GUI with WPF (Windows) and now I want to connect the mono dll to the WPF Form so I can use it's exported functions and classes. Same on Mac OS X: GUI written in Cocoa and connected to a mono core dll?
Do you guys know any example projects, which uses that approach?
Well, you can use a PCL library that contains your logic, combined with the Xamarin.Mac framework on OSX, GtkSharp on Linux, and WPF on Windows. As for using raw Cocoa, that'd be tougher; you'd have to host the Mono runtime (which is not impossible but also not easy).
Edit: I should add that you could also try for a "write once" UI and use GtkSharp for all three.
I found a possible solution: https://github.com/picoe/Eto
It does exactly what I was looking for!

Is it possible to write shared libraries between iPhone, Android, Blackberry, Mac and Windows?

I'm tasked with "porting" a few apps from a Windows environment to various mobile platforms and Mac as well.
I plan on writing MVC patterned apps in which I write as many controllers as I can in some sort of universal library, probably in C or C++. Then writing the views in various choice languages (Objective C, Java, .NET, whatever) for the target OSes.
I've never attempted anything like this before, so my questions are: Is it possible to write and compile one library that can be used on iPhone, Android, Blackberry, Windows and Mac? Is it even wise to try this?
I understand that certain native methods simply won't be available on each platform.
You can create a library whose source code is portable, assuming that you properly abstract away any platform-dependent calls. You can't, however, create such a library, compile it, then use it anywhere; you'll have to compile it for each platform.
Your should take a look at the Mono Project. http://www.mono-project.com
...more specifically at :
MonoTouch: To develop iPhone applications in .NET
MonoDroid (BETA): To develop Android applications in .NET
Mono plugin for MeeGo: To develop MeeGo applications in .NET
And you know that you can develop on Windows Mobile in .NET already.
I've haven't found anything related to BlackBerry yet.
There are services like Rhomobile and Appcelerator which will allow you to do this sort of cross compiling.
I've never used either however.

Resources