I mean, if I send an apk developed in Xamarin to my friend to install, does he needs Mono framework on his phone or it will install and run without any 3rd party application?
On Android, Xamarin ships a fully functional implementation of the .NET runtime, called Mono, bundled with your app so that your code executes with all of the power of C# and .NET, including JIT-compilation, memory management, reflection, and the .NET base class libraries.
Source
Yes, that should work fine without requiring Mono to be installed on your friend's device.
Related
I have built an (Windows Forms App) application on Windows in C#. Now, I would like to target this whole project / application to mac OS without changing the application. Is there any easy way to achieve it? I don't want to rebuild the entire app from scratch on MAC. I don't want to use virtual machine on MAC... I have Visual Stuido 2017 and a paired MAC. But, I'm lost here.
;TLDR Mono, using WinForms and MonoDevelop IDE for development.
.NET Framework is the full implementation that includes everything but runs only on Windows.
.NET Core is the newer OpenSource implementation of .Net framework but doesn't include WPF/WinForms - because those rely heavily on DirectX/GDI essentially making them Windows only.
Xamarin. Xamarin based off of Mono framework branched more towards iOS and Android. There is a Xamarin Mac but it supports the same GTK# based UI toolkit as Mono.There is a WinForms equivalent UI toolkit as well called Xamarin Forms but it is mobile only (iOS, Android & Universal Windows Platform)
Mono. Mono is OpenSource implementation of .Net framework, uses GTK# by default for UI. Does run fine on all of Windows, Linux, macOS. Uses GTK# as underlying UI toolkit on all OSes including Windows.
What's Cross Platform? There is a subset of Base Class Library, called .NET Standard Library - as well as the compilers platform, only these subsets of .Net are truly cross-platform.
To sum it up,
Mono does however support Windows Forms on both Linux & macOS.
Except some corner cases it works very well.
However the UI look and feel is Windows only. It is like running Windows applications under WINE. Default Mono IDE is MonoDevelop.
Xamarin Mac is great if you want to write a new application from scratch since Xamarin Mac exposes you full macOS SDK and offers its own IDE (Xamarin Studio).
In your situation though, Mono is best option. After having installed mono you can even try running your current app as mono appName from terminal. It should render the UI even if the paths and other resources are broken.
Update 2021
WPF and WinForms now are open source and part of .Net Core (which now is referred to as .Net. Core is dropped in name). The previous classic .Net is now called .Net framework. New WPF/WinForms features enhancements are on available for .Net only. Though these still are Windows only and will stay so.
Avalonia UI Framework and Uno Platform are newer .Net Core (AKA .Net) based cross-platform solutions. Both use XAML. Avalonia is more like WPF while Uno tries to be cross-platform UWP.
You have to use .NET Core (not .NET Framework) to run app properly on different OS than Windows.
Differences between platforms explained
I've a Win32 application written in C# via Visual Studio 2015 and I want to make it portable in order to avoid the installation of .NET framework everytime I deploy my application to clients.
I read this article: the key point of making portable apps seems the use of mscorlib.dll
This method doesn't work, at least for me, despite my effort. I must presume this is not the real way to build an application as portable...?
What are my other options in Visual Studio? Should I rethink my entire application to avoid the use of NET?
Portable applications and packages still require .NET, but in a way you are not using the entire subset available in .NET, which makes it portable among different platforms (Windows Phone, Universal Apps, etc.).
As far as I know the only option you have to overcome the dependency on the .NET Framework, is by compiling your assembly in 'native', which will include all code necessary to run the app on its own.
I am new to using .NET, but I am interested in using MonoTouch/Droid to write mobile applications that could share some core code.
I have many C style API libraries I wish to use, for example libxml2. How do I call these native library methods in Mono? Can I use the same binaries compiled from Windows if I am developing in Windows? Can I use the Windows binaries if I am developing in OS X?
How do I call these native library methods in Mono?
You use p/invoke (platform invoke) to call native C code from any .NET language. You need to write those declarations (of find someone who did it before you) to use the native libraries. Like #Marcelo commented there are often very good, much easier to use .NET alternatives to most C libraries.
This will work on MonoTouch too. However you'll need provide a static library (.a on OSX, like a .lib on Windows) since Apple iOS does not allow linking with user-provided dynamic libraries (.dylib on OSX/iOS and .dll on Windows).
Can I use the same binaries compiled from Windows if I am developing in Windows?
Windows produced binaries should run fine with Mono on Windows. You can use Microsoft .NET on Windows too.
Can I use the Windows binaries if I am developing in OS X?
If the binaries are .NET compiled code then yes - as long as your p/invoke declrations are portable (e.g. 32 vs 64 bits types).
If the binaries are native code then no. Remember that Mono is not a Windows emulator. It runs CIL code, inside .EXE or .DLL, but it won't run native Windows code or provide access to Windows native API (outside Windows).
I'm a newbie to programming, and I'm considering using C# to write a VERY simple program that simply edits a text file.
Will it work on Macs and Linux? What will work?
I want to know what makes a program cross-platform?
C# can be compiled for and ran on multiple platforms (Windows, Linux, macOS) by using .NET Core.
Previously, cross-platform development using C# could only be done by using Mono which is a third-party implementation however it is now recommended to use .NET Core as it is developed by Microsoft.
Now C# is fully cross platform and has variety of frameworks and run times.
Java is a language + framework. But C# is just a modern language. C# language features are very powerful, easy to learn. No confusion between framework and language.
C# can be used in following frameworks
.Net core (Multi platform supports Linux, Windows and Mac), mostly used to develop restful services, web applications and enterprise systems
.Net Framework (Windows only), Same as .net core, but has more windows only features
Unity - One of most used game engine to develop games for PC, Sony, Xbox devices etc..
Xamarin - To develop native Mobile apps (Android, IOS, Mac)
.Net standard - Create a library in .net standard use in all above applications
Java - Code once, Ship same file to all platforms
C++, C, Rust - Code once, Compile for specific platform
C# - It is just a language, pick your framework according to requirement.
Most popular applications like Chrome, Firefox uses C++, Rust and they are compiled for each platform. But still they share the majority of code between these platforms. Some games use C++ to share the code between IOS and Android.
For new developers its good to start with NodeJS and C#. Both are easy and can do any type of applications.
It's hard to answer something like that to somebody, which states that he just starts programming, but I'll try to give you an (somewhat simplified) overview: C# is a language, which is compiled into an executable program. The language itself is portable between plattforms, as long as you have a compiler on each target plattform. On Windows you have the "default" .Net implementation and on Linux/Mac you have Mono. To do something useful - like editing files - you have to use some libraries. There is a standard library which is available on each plattform. As long as you use only that functionality, your program will be cross plattform. Obviously is will not be cross plattform, as soon as you use some library specific to a certain plattform. Editing files is part of the standard library, so you can implement such simple tools in a cross plattform way. When choosing a book, you should look for books which focus on the "raw" language and not on Visual Studio or other specific tools.
A new open source release from Microsoft called CoreCLR is cross-platform and can now be used for this
The CoreCLR repo contains the complete runtime implementation for .NET Core. It includes RyuJIT, the .NET GC, native interop and many other components. It is cross-platform, with multiple OS and CPU ports in progress.
-from the CoreCLR repo
I would not recommend c# as the top choice for multiplatform coding. I would recommend python instead it is very easy to run even as a script and works perfectly on all platforms. If you insist on c# be prepared to deal with the same problem explained by Justin Ethier. Python on the other hand, is the same for all platforms, it is super powerful fast and even has wrappers ready to connect to other languages.
C# is cross-platform thanks to .NET Core, but without a cross-platform User Interface library you can only make very basic console programs with it. In order to make cross-platform apps for Windows, Mac and Linux you need a cross-platform User Interface library like Nevron Open Vision
Yes, C# is fully cross-platform thanks to .NET Core.
.NET Core is a free and open-source, managed computer software framework for Windows, Linux, and macOS operating systems. It is the cross-platform successor to the .NET Framework which only run on Windows. The project is primarily developed and supported by Microsoft (through the .NET Foundation).
C# is cross platform and you can run your program in Windows/Linux and Mac. For Linux, though, you need to run it using mono
as jvm makes java as plateform independent is it possible with CLR to make .net framework supported languages like c# plateform independent on mobile
Yes, you can use the Mono CLR. Mono is the open source implementation of C#, .NET BCL and the CLR.
MonoTouch runs on the iPhone
MonoDroid runs on Android devices
Yes-ish. At the tooling level, see MonoDroid, MonoTouch or the WP7 tools. However, in each case you are using the language to target a specific mobile platform. You may need different UI code for each, even if the core code is shared.
.NET Compact Framework works on mobile devices (and has for about 8 years now). .NET is also cross-platform (kind of) through the Mono and MonoTouch projects.
Technically, yes, but each handset has it's own limitations that may not make it very feasible.
If you look at the mono-project, it's a portable implementation of the CLR which can target mobile architectures, but it's still an area of development and not very mature yet.
MonoDroid is the project targetting Android handsets, but it's in a beta stage at the moment.
MonoTouch can target iOS, but it cannot take full advantage of the framework. Apple's licensing prevents virtual machines from running on the iOS, so .NET applications need to be AOT (Ahead-of-time) compiled to run on it. This works, but you won't be able to use parts of the BCL like the reflection API.
There's some early development for mono to support WebOS (Palm) too.