Xamarin based Mac OSX app deployment size - macos

I'm thinking about porting a .NET based desktop application to Mac using the Xamarin.Mac platform. I can't seem to find any info about deployment size of the resulting application. Is it like Xamarin iOS development i.e. the C# code is natively compiled into mac code and I don't have to worry about distributing the .NET runtime? If no, then how large is the .net runtime that I need to distribute with my application?

Xamarin.Mac apps are self-contained and do not require a separate Mono framework to be installed. Only the portions of the framework that your app uses are included inside the app bundle in order to keep the size as small of possible.
A x86_64 Xamarin.Mac Cocca Hello World Xamarin.Mac Mobile Framework based App with the linker set to:
Don't Link: ~48mb
Link Framework SDKs Only: ~20mb
Link All: ~20mb
Note: Sizes based on Xamarin.Mac 2.9.2.81
Note: Using the other Xamarin.Mac frameworks will of course produce slightly larger bundle sizes...
Note: This is a do nothing app, so once you start adding assets, content, code, external packages, etc... your app size is going to grow.
Xamarin.Mac apps are not compiled via LLVM into bit-code and/or machine code like Xamarin.iOS apps. There are some old email threads floating around that this was begin looked at along with AOTing, but I assume lack of demand vs. engineering time required never was justified.
Note: It is possible to use a custom OS-X Mono build that is LLVM-enabled, but I have not done this in x86_64-based Mono OS-X apps for App Store distribution, only local app for private distribution. This is all done outside of Xamarin Studio and not a supported configuration. That said and with xamarin-macios begin open-source now, if you are using Xamarin.Mac Mobile Framework in your OS-X app which is the shared Unified framework, you can wire up an Mono/LLVM-based build environment, but again, not a Xamarin supported configuration.

Dec 2018, Xamarin.Forms + Xamarin.Mac give 16Mb bundle size for a an app with 5+ forms. This is a self-contained application with no dependency on Mono or whatsoever framework installed.

Related

Can xamarin apps be built for Windows, MacOS with same source code?

Given an app written in C# for Xamarin, can it be built to run on all the supported platforms with minimal changes, including Android, iOS, MacOS, Windows?
I realize that Xamarin claims 90% of the code is shareable across platforms (and 10% needs to be customized), and I'm referring to that "90%".
What I don't understand is whether that 90% is shareable across the different Xamarin tools,e.g. Xamarin.Forms and Xamarin.Mac or if those are substantially different tools with different APIs, etc.
For example, I see that with Xamarin.Forms I can build for iOS, Android, and Windows. But not MacOS. So, on a Mac, can I install Xamarin.Mac and then build the same app for MacOS ?
You can add a MacOS target for your Xamarin.Forms-based UI, of course, this is done via Visual Studio for Mac:
https://learn.microsoft.com/en-us/xamarin/xamarin-forms/platform/other/mac
There are items within Forms that are not feature complete on MacOS and thus it is still in a "Preview" release and those are listed on the "Platform Support macOS Status" wiki:
https://github.com/xamarin/Xamarin.Forms/wiki/Platform-Support-macOS-Status
Xamarin.Forms is the framework that allows you to create cross-platform apps between Android, iOS and UWP. In my experience, a lot of the features of Xamarin.Forms do not transfer over to Xamarin.Android. In fact, a big chunk of the way things are done for UI Xamarin.Forms will not transfer over to the Xamarin.iOS and Xamarin.Android. Most of the times when I find a solution that works in Xamarin.Forms and I try to do the same thing in Xamarin.Android I end up just figuring out the problem myself in Xamarin.Android from scratch.
When they say that 90% is shared, they mean that within Xamarin.Forms... 90% of the work on your models and code behind can be shared between the projects (within that Xamarin.Forms solution) and 10% will have to be custom tailored for each platform (UWP, Android, iOS)
EDIT: Just for clarification in the future, you need an iOS device or an iOS virtual machine to compile the code on iOS
To build Xamarin.iOS apps with Visual Studio 2019 on Windows, you will
need:
A Windows machine with Visual Studio 2019 installed.
This can be a physical or a virtual machine.
Windows system requirements
A network-accessible Mac set up with Apple's build tools and Xamarin.iOS.
Visual Studio 2019 accesses this machine over a network
connection to use Apple's build tools, which are required for
compiling native iOS applications.
Mac system requirements
source: https://learn.microsoft.com/en-us/xamarin/ios/get-started/installation/windows/?pivots=windows
As long as you use .Net code and Xamarin.Forms it is 100% portable/sharable across every single project. Xamarin.Forms are currently in beta for macOS and Windows WPF (but for UWP it is not beta), and for macOS particularly they don't have the true native look.
Xamarin does support using the native interfaces and native APIs and whenever you do that, it is not portable.
So there is nothing like 90% sharable, it may be some estimate for some cases. It can be 100% sharable or it can be only 10% sharable depending on your project and how much you stick to the sharable APIs.

React Native newbie

I want to build a game with React Native. I am doing my testing locally on a personal Android device using the Expo app but ideally would love for the app to be cross platform. I do want to release it to a public store or have it be available for folks to play in some format.
Is it OK if I am using Visual Studio Code (on a Windows machine) to build my app, using node.js command line to run expo commands and testing with live reloading on my Expo app? Do I need to have a Mac + XCode if I want to edit iOS code?
What is the typical development process/toolset used?
React Native IS cross-platform, building the apps for production on different platforms, however, requires a different procedure. What makes it cross platform is that you write the source codes including all of the components (Well most of them) one time, and it automatically generates the native codes for Android and IOS.
There's no typical toolset for writing code, you can use any code editor you prefer (I use Sublime for example), but you should have the needed requirements listed in the getting started page in the official official docs including node.js.
Expo helps in testing the app on both android and ios without the need of a Mac (it has some other cool features too!). So if you want to release to apple store, you'll definitely need a mac (or a virtual machine running MacOS like VMWare)
In order to generate the release apk for android: Android Release APK
and for IOS: IOS

Will Xamarin carry its runtime for all its apps?

I am wondering Xamarin carries Mono runtime with its all app package. In this case, if two Xamarin based app installed in a device which will be having two Mono runtime right. Is it a limitation with Xamarin?
On iOS each app has its copy of the runtime. iOS does not allow for sharing of between apps.
On Android you have the ability to select whether or not to use a shared runtime, but this is generally recommended only for debugging, not production.

Is it possible to develop a desktop application, which will be supported in both Mac and Windows, using Xamarin in Visual Studio?

Our team would like to develop an application in Visual studio and Xamarin. The app needs to be supported in both Mac and Windows. We prefer Xamarin because the back end code can be shared. If possible, how to build and publish it so that it can be only installed in the machines. We are not planning to submit this app to the corresponding app stores.
You can write and Windows Application with C# using WinForms, WPF, WinRT (Windows Store apps).
Also you can write Mac application with C# using Xamarin.Mac.
To share the code between Windows App and Mac App, you just need to split your code into shareable Business Logic (part) and specific UI part.
To share the code, just use PCL libraries.
Yes.
The core business logic can be written in shared code usable on both platforms.
You have a couple of choices of how to develop the UI. You can use native or Xamarin Forms.
If you use native then I would suggest using the MVVM pattern with a framework like MvvmCross. You can then write the bulk of your app in shared code and just write the UI in platform-specific code, with the windows UI written as a standard windows WPF or UWP app, and the Mac app written using Xamarin.Mac using the native Mac API.
If you want to use Forms then you may have to compile the binaries yourself to get Mac support as it won't be available till roughly May 2017, but you could get started building a Forms app for UWP/Windows now and add the Mac project once it is available.

Xamarin: Can I do in a cross platform project the "Android part" and do IOS when the rest is finish?

I have a project in Android Studio (on a pc), and as far as I know now Microsoft owns Xamarin and its free once you have a Visual Studio license, then you can develop apps using C#(Already know that I have to port the JAVA code) and then compile in a MAC the IOS app.
My 2 concerns are:
When you can't compile, will the IDE show the IOS related errors?
There is a clear implementation of "cross platform code" vs "specific code"?
How Xamarin manage it?
In addition, our plan is to finish the app for Android which is our primary target and then manage the IOS, besides the other questions, what I need to know is if that is possible.
Yes, the VS IDE will show you build errors from the iOS build server.
Yes, you can build an Android app using Xamarin and later extend it to build an iOS app also. This is easiest if you use Xamarin Forms, but it also possible with native Android/iOS UI, but will be much more dependent on how you architect your applications.

Resources