10 ms·
Ask HN: Are you using .NET to write cross-platform desktop or mobile apps?
Microsoft's .NET is an open-source platform for building desktop apps and mobile apps (and more) using C#, F# and Visual Basic. Does this sound too good to be true?
For example, Electron is often discussed on HN (liked and disliked), but .NET is far less discussed as a cross-platform option.
Similarly, Xamarin is a platform built on top of .NET for building Android and iOS apps (using one codebase). This sounds like the holy grail of mobile development. But what is the reality?
I did a search on HN and found no stories about Xamarin from the last year. The top search results are HN stories from 5-10 years ago. This makes me wonder how popular .NET is for cross-platform desktop or mobile apps.
What has been your experience using .NET writing cross-platform desktop and mobile apps?
- stop50 4y agoXamarin is apparently merged into .net 6as .Net.maui. i only know 1 application that is multiplatform and relative popular: keepass.
- thesuperbigfrog 4y agoYou might want to consider how much Microsoft uses it in their own products before choosing to use it. This article describes the situation pretty well: "not even Microsoft, literally the people who own Xamarin, use it in any of their big products like Teams, Outlook, and the list goes on. Instead, they reach for native development or Electron. So we can just tie a bow in it and have a minute's silence for another end-of-life cross-platform software development framework." "None of These Problems Are Solved With MAUI. The poor developer experience, how apps look, XAML being a pain, and these other core issues won’t be resolved by MAUI. So, if you already know Xamarin Forms, and you’re waiting for MAUI to land, but you’re not 100% thrilled with the experience so far, then it’s a great opportunity to think about learning something else." Source: https://betterprogramming.pub/xamarin-forms-is-dying-and-maui-may-not-be-future-f0395575ac5d https://betterprogramming.pub/xamarin-forms-is-dying-and-mau...
- windows2020 4y agoIn the case of Teams, I think they regret choosing Electron. A Xamarin app doesn't need to use XML or Xamarin Forms which provides UI components. A totally custom interface/game can be developed with Xamarin + SkiaSharp which provides drawing primitives.
- giaour 4y agoAs a user with a finite amount of memory on my computer, I also regret them choosing Electron.
- yrgulation 4y agoThey should hire better engineers, perhaps those with more experience than just leet code. The apps i built using electron for some clients have none of the issues teams has. I mean come on, teams is a basic chat app, how difficult is it to optimise it?
- seper8 4y agoYes, it's a "basic" chat app. Like google is a "basic" search engine, how hard can it be to make something like that? Just make it go search?
- yrgulation 4y agoComparing teams to google is a bit meh. There’s nothing special about that app other than how crap it is. A poorly written tool made by inexperienced devs.
- giaour 4y agoTeams is also very bloated (or "full featured" depending on how you want to spin it) compared to other chat apps, which does make it special by comparison. Teams is trying very hard to make itself a platform, and it supports telephony in a way that other chat apps don't. I can be reached on my work Teams account via a dedicated phone number, and the account includes a bunch of Viva applications and pretty deep integrations with Office, SharePoint, and Power Platform.
- bob1029 4y agoWe are on top of .NET 6 today. Been using a .NET stack for over half a decade in production. We still just do the web app thing. For our business & customers, this is the lowest-friction way to deliver the application experience. So, we are effectively cross platform on both our client and server. We only have to maintain one code pile to make it all happen. If you can figure out a way to make the web work for you, try it. Having an app icon on someone's phone is such a ridiculously wasteful thing to chase unless you can properly justify it.
- andix 4y agoYou can still build a simple webview wrapper and put it to the App Store.
- jjnoakes 4y agoNot really. See 4.2. https://developer.apple.com/app-store/review/guidelines/#minimum-functionality https://developer.apple.com/app-store/review/guidelines/#min...
- dncornholio 4y agoNothing to see. Webview apps are still being accepted by the App Store. They don't care what tech you use to build your app, as long as it provides functionality.
- andix 4y agoIf it is „app like“ that’s enough for the App Store. It can’t be just a browser for a desktop website for example. It’s all about functionality and UX, not about technology.
- CyanLite2 4y agoXamarin is now called MAUI. You'll find better search results using the MAUI term.
- windows2020 4y agoI love C#.NET + Xamarin + Visual Studio. * Easy to get started * Builds for iOS on a remote Mac but runs in local emulator * Performant! * Simple to write device specific code * Power of .NET * Supports more than Android and iOS, like desktop UWP
- tyleo 4y agoWe built Rec Room (https://recroom.com/ https://recroom.com/) using Unity across several platforms: * iOS * Android * PC * PlayStation * Xbox * VR Rec Room is a "game for building games". I'd say Unity has worked pretty well. Given that the product is a game this success with single-lang cross platform may be more common than other industries. Still, though, I'm surprised that there isn't a similar "engine" for non-game cross platform development like Unity or Unreal that folks are generally happy with. (Shameless plug, we are hiring if folks are interested https://recroom.com/careers https://recroom.com/careers)
- robotnikman 4y agoFunny enough, I have seen some people use Unity to develop basic cross platform applications rather than games.
- rcarmo 4y agoI just commented someplace else that I’m using Godot to achieve exactly that. Much smaller and nimbler than Unity, too.
- flanbiscuit 4y agoAt a previous agency job, I was on a project that was re-writing an iOS and Android app used by millions of people. We looked hard into using Xamarin for this but in the end concluded that it was not ready yet. This was in 2019. Main reasons were: - You can use Xamarin.Forms to write cross-platform UI, but our UI was complicated enough (a weather app with lots of custom UI) that Xamarin.Forms would not have worked for us. So we still needed to write 2 separate UI codes, which Xamarin allows for because it exposes the complete SDKs for both platforms via Xamarin.iOS and Xamarin.Android. - Xamarin provides a way to use existing 3rd party libs written in native iOS/Android by creating "bindings". For very popular libs, the Xamarin team maintains these bindings, for others, you need to rely on open source ones. The client required us to use a bunch of third party libraries and we either couldn't find them at all, or found ones that didn't work. We needed Mapbox, Firebase analytics & Crashlytics, and some other ones... pretty well-known libraries. We were in contact with someone at Microsoft during this exploration and even they couldn't help us. They couldn't point us to any big well-known names using Xamarin and they couldn't help us with any of the missing or broken bindings we needed. Thankfully in the end we just split up into 2 teams and wrote the app in native iOS and Android.
- jjnoakes 4y agoDid you consider writing the bindings yourself? In my experience when I've needed a few dozen APIs, it wasn't too bad. It certainly seemed like less work than two native apps. But perhaps that wasn't the case for you?
- criddell 4y ago> Thankfully in the end we just split up into 2 teams and wrote the app in native iOS and Android. When you have millions of users, that's definitely the right call.
- HideousKojima 4y agoI use Godot for cross-platfotm native apps, specifically the Mono version. Very excited for the .NET 6 version to become generally available soon. Things have worked just fine for me, though I haven't made anything too serious with it yet.
- adamdusty 4y agoThere are gui frameworks made by the community as well. Avalonia has picked up steam since it supports Linux and has been around for a while. Documentation is lacking and I can never get it to work the way I want but I suspect that's more my fault than theirs. Uno is another cross platform C# gui framework. I gave up on C# gui apps before I ever tried it out, but it looks good.
- adnanc 4y agoI initially developed an iOS app (https://ayahbyayah.com https://ayahbyayah.com) using Objective-C in 2012 (10 years on the AppStore next month) Re-developed in Xamarin.iOS in 2016 which has been a solid decision due to the productivity gains I get from C# and Visual Studio tooling. Xamarin.Forms works well for line of business apps and the performance with iOS was fine, however encountered a number of Android performance issues which is simply due to the nature of the framework.
- ducharmdev 4y agoAs a .NET developer that's focused mostly on web development (e.g. APIs + SPAs), I've not been very eager to wade into the pool of XAML that is .NET desktop/mobile frameworks. But I'm becoming more optimistic with the introduction of Blazor Hybrid. Whether you're using MAUI for mobile & desktop, or WPF/WinForms for just desktop, Blazor Hybrid provides you a web view that enables usage of Razor components made of C#, HTML & CSS. These components run natively, not in the browser. After using Maui + Blazor with Tailwind for styling in a recent side project, I can see this becoming a viable alternative to Electron.
- n8cpdx 4y agoHow is the performance? I was tempted to do some blazor work after trying some blazor demos on my M1 Mac. Then I tried it on my not-that-old Xeon windows desktop and it was unusably slow. It can run Google Earth and Visual Studio (and a whole bunch of electron apps) just fine, so my assumption was that Blazor is actually just bad.
- ducharmdev 4y agoWhen you say performance, are we talking about the tooling, running the app itself, or both? Also were you using Blazor Server, WASM or Hybrid? Personally I've not run into any big issues like that; although my work laptop is pretty beefy, I did my side project on an old laptop that can't handle really large .NET solutions (e.g. crashes every 10-30 seconds simply navigating the Roslyn codebase...), but it did okay with Maui + Blazor Hybrid. Alternatively, I think it's possible to use vscode if you're friendly with the dotnet cli, but I had trouble getting the workloads to work correctly and didn't wanna fuss with it at the time.
- whycombagator 4y agoAs mentioned Xamarin is now MAUI[0] The only app I know of using it is Bitwarden[1] [0] https://docs.microsoft.com/en-us/dotnet/maui/what-is-maui https://docs.microsoft.com/en-us/dotnet/maui/what-is-maui [1] https://github.com/bitwarden/mobile https://github.com/bitwarden/mobile
- nso 4y agoI've deployed an MAUI-app to production. I chose MAUI since the rest of the stack is dotnet and we have ready built SDKs in dotnet to communicate with the backend, so I had a functioning login page up and running in minutes. It was a very frustrating experience in the early days, but as MAUI has matured it's now a pleasure to work with. It is not as feature rich as some other frameworks, but it fulfilled our needs.
- naikrovek 4y ago
- whycombagator 4y agoYour comment doesn’t add to the discussion. On the subject, although I generally agree with you, there is a lot more favorable press/comments for MSFT stuff these days on HN
- desaiguddu 4y agoIMO, You should only build on .NET platform if there are usable components which are already made in .NET. Keeping up Cross-platform framework updated with the changing OS versions is difficult. Preference would be to use Flutter (Google) or React Native instead of Xamarin.
- BiteCode_dev 4y agoI don't trust the "new nice microsoft this time it's true we love FOSS and users I swear" enough to tie my stack to any of their products. Things like VSCode, github or azur pipelines are ok because the cost of a potential migration away from them is tiny compared to the benefits they bring. However, basing your entire code base (e.g: with .Net), dev env (e.g: codespaces) or infra (e.g: azur cloud) on their tech is betting that a company with a terrible track record will never, ever, go back to its previous bad practices. I'm not making that bet.
- alexb_ 4y agoMAUI is less cross-platform friendly than you might think. I'm using Avalonia right now, which works well.
- jayd16 4y agoHow so? Buggy features on certain platforms or something else?
- DonnyV 4y agoIt doesn't run on Linux. Not sure how they can call it "cross platform" if it doesn't run on Linux. Maybe across Microsoft's platform.
- nso 4y agoAcross Microsoft's platform? It runs on iOS, macOS and Android. Linux desktop is a insignificant dwarf compared to the forementioned. It's also super fragmented (what is linux desktop anyways?) and hence a ton of work to have something reliable working there. It's easy to understand why it has not been included as a first-class citizen for MAUI. dotnet core is also open source and runs perfectly on linux, but again -- desktop no bueno.
- kolbe 4y agoIt's for front-end development. There are ~0% use cases for a linux UI outside of development tools and maybe database monitoring tools?
- alexb_ 4y agoThere are plenty of people who daily drive linux that would disagree with there being "zero use cases"
- kolbe 4y agoIf you ever are curious about how product managers make their decisions, it's based on more that 'plenty of people'. If you want to be a good engineer, you should also learn the difference between zero and approximately zero, if you want to quote people.
- pjc50 4y agoI'm maintaining a cross-platform headless application at the moment. The frontend is in Java maintained by a different team. Dotnet core works pretty well for Windows/OSX/Linux. The UI story is .. less encouraging. I'm not sure a UI that's both cross-platform and native-compatible is even possible. Microsoft have a load of offerings none of which anyone is really happy with. I think the main way of building a cross-platform app in C# is not Xamarin but Unity...
- n8cpdx 4y agoMicrosoft stopped development (more or less) around May 2020 to focus on MAUI, which was released in November 2020. Actually it wasn’t - MAUI wasn’t released until May 2022, tooling was just released July 2022 for Windows, and VS for Mac with proper support has yet to be released. If you’re used to command line that may not seem like a big deal, but the whole point of the .NET ecosystem is that you have a rich set of tools that saves time and enhances developer productivity. So as for why Xamarin wasn’t discussed for the last few years, it’s probably because Microsoft put it in a coma for 2 years. I was hoping MAUI would fix a lot of the quality issues, but like any big rewrite, it seems to have traded one set of problems for another. The developer experience is better, but there are lots of bugs in basic functionality that make it difficult to use. https://github.com/dotnet/maui/labels/t%2Fbug https://github.com/dotnet/maui/labels/t%2Fbug I don’t think Microsoft has enough engineers assigned to this project to make it successful. If you don’t care about the quality of your app (e.g. your a corporate form developer and don’t care about your users) MAUI is a great choice. But if you don’t care about the UX, web technologies are almost certainly a better choice. As for native desktop, you’d have to be really stupid to choose WinUI or UWP, unless the point of the app is to be a WinUI or UWP demo. WPF is fine, but then why on earth would you choose that over electron or WebView2, which solves some of the resource problems from pure electron. All of this is coming from someone whose entire career is built on .NET client technology… I was really hoping (and still hope) for a turnaround. I bet big on Xamarin being the right approach; I still think it is, but Microsoft really dropped the ball since the acquisition.
- brtkdotse 4y agoWhat’s your opinion on WinForms? I’ve yet to come across anything that’s better in terms of perf, developer experience and stability.
- n8cpdx 4y agoWinForms is fine but there are issues with support for things like high DPI. Maybe that’s fixed now. I wouldn’t use it except for a very small utility, but nowadays I just use python scripts for small utilities. Based on the .NET Rocks podcast, it sounds like Blazor is the new WinForms. Given the situation with Windows, I don’t see it being a great choice for a monoplatform app (unless that app is a game) - chrome books and Mac are getting more popular, and web works everywhere.
- romanhn 4y agoI recently spoke with the tech lead of a team that is all in on .NET for web development, as well as using Xamarin.Forms to develop cross-platform mobile apps. While this achieved their goals, the lead felt that the complexity of dealing with platform-specific edge cases slowed them down enough that developing using native tooling would have taken the same amount of time. He would not choose Xamarin again if faced with the same choice.
- guhidalg 4y agoThis and other stories reinforces my belief that Kolmogorov complexity in software is a real thing(tm) and cross-platform GUI tooling will never be good enough to avoid having to write platform-specific code.
- zigzag312 4y agoIssue with Xamarin.Forms was that provided widgets were quite lackluster and to write custom widgets you had to know native APIs of multiple platforms. IMO, the source of the problem was that it's widgets used native widgets for rendering. Build-in widgets were lowest common denominator, primarily supporting only features avaliable on all platforms. Where platforms deviated, complexity started. However, UI frameworks that render widgets themselves, using drawing APIs, are a completely different story. They are harder to create, as they need to develop all widgets from scratch (rendering, text, input, accessibility etc). Basically reimplementing part of OS APIs. But once this is complete, the hard part is done and supporting additional platforms is relatively simple. Avalonia has written good blog post about this: https://dev.to/avalonia/avalonia-platform-support-why-its-simple-cjd https://dev.to/avalonia/avalonia-platform-support-why-its-si... Developing cross-platform GUI application with this kind of frameworks is about as complex as developing GUI application using native SDK for a single platform. Most complexity doesn't result from different platforms anymore, but from different form factors and input devices. They have one Achilles' heel however. The web. HTML is unfortunately much higher level that drawing API on other platforms. So, the only option for the web is usually WebAssembly.
- DonnyV 4y agoFor cross platform framework. I would recommend Avalonia https://avaloniaui.net/ https://avaloniaui.net/ It has the flexibility and cleaner version of WPF but also lets you build it all in code if you choose like Flutter. They have a support business to support the project. So you know it will be well supported for years to come. The team is very responsive to the community also. If I was Microsoft I would just fork Flutter and add C# support and call it a day. Flutter is really flexible for mobile and desktop and has a ton of community support with libraries.
- david422 4y agoYou could try google's flutter: https://flutter.dev/ https://flutter.dev/ for cross platform. I'm currently building a sample app and seems to target and work decently well across the biggest platforms - web, mac, win, linux, ios, android.
- kasajian 4y agoWithout third-party libraries and/or frameworks, you can't target the same desktop applications that Electron can. For instance, .NET didn't have a cross-platform desktop offering until the last few months with the introduction of MAUI, which supports both Windows and MacOS, but not Linux. However, if you go outside of what Microsoft offers directly, there's many options, some of which do something similar to Electron. Two off the top of list is the Uno Platform and Photino. There's others. They come and go.
- shrubble 4y agoNot available for FreeBSD? Not very portable across platforms, it seems.
- Kipters 4y agoXamarin (native) used to be my go-to technology for cross-platform mobile apps, but Microsoft has absolutely driven it into the ground since the acquisition. Looks like they only care about MAUI, for which I couldn't care less given the horrible user and dev experience. The motto for Xamarin used to be "you can do all the same stuff you can do natively, with day one support". Not anymore, and it's disheartening to see.
- zigzag312 4y agoFor .NET cross-platform UI there are: MS frameworks: - MAUI (ex Xamarin.Forms) which is similar to React Native as it's controls use native widgets for rendering. - MAUI Blazor which is similar to Electron and Tauri as it uses web view to render widgets. - MAUI.Graphics.Controls (experimental) which is similar to Flutter as it uses Skia to render it's controls. Non-MS frameworks: - Avalonia - Uno Both Avalonia and Uno are similar to Flutter as they use Direct2D, Skia, etc for rendering. Quick comparision I just found: https://github.com/robloo/PublicDocs/blob/master/XAMLFrameworkComparison.md https://github.com/robloo/PublicDocs/blob/master/XAMLFramewo... Note, that it's already a bit outdated as Avalonia 11 is adding support for mobile and WebAssembly. Avalonia was more focused on desktop (Windows, Linux, macOS) until recently. Android, iOS, WebAssembly is still in preview. However it does support embedded platforms, like Raspberry Pi, Torizen. It's also able to run without a desktop environment. https://dev.to/avalonia/turning-it-up-to-11-34jn https://dev.to/avalonia/turning-it-up-to-11-34jn Uno I think was more focused on mobile in the beginning and expanded from there to other platforms. All of these frameworks are build around XAML. There is some support for using C# instead of XAML, but most docs/examples are for XAML. Search 'C# Markup' for more more details.
- edimoldovan 4y agoMaking a choice based on popularity of the tool might be the wrong approach. If making a choice is even needed. If I would start something now I would most definitely go for Swift/SwiftUI and Kotlin/Jetpack Compose. I find that productivity, developer experience are best with those as soon as one gets the hand of them. Also, these are the only ones to be guaranteed to be around long-term. While any of the cross platform options sound interesting, there is no guarantee they will be around.
- aspyct 4y agoI used to write xamarin apps for a living. It was great, until it became terrible. Nowadays I don't develop mobile apps anymore. Last time I checked, Xamarin Forms was half decent to build simple apps, but you have to be pretty flexible on the specs and the visual design. Still, for data entry apps and other simple purposes, it can be fine.
- rcarmo 4y agoI had a play with it and Avalonia on Mac, Windows and Linux: https://taoofmac.com/space/blog/2021/11/14/1600 https://taoofmac.com/space/blog/2021/11/14/1600 However, right now I’m actually writing a simple GUI app in Godot (the game engine), because it is the closest thing to Delphi/Lazarus that I can actually be productive in…
- sandreas 4y agoAs a C# developer currently trying to improve my skills in UI development this HN thread is enlightening (thank you) but really demoralizing... I noted down the following technologies to be the next thing to learn / take a look at: * MAUI + Blazor Hybrid (no official linux support, which usually is a no go for me) * AvaloniaUI (looked very promising, especially the 11 Preview1[1], although not microsoft) * Uno Platform (also not bad but not from Microsoft...) I thought, it would just be a matter of "which one is the best", but it seems that all these did not come to stay or do not have official support from Microsoft (which usually means not getting widely adopted). An AvaloniaUI example App named Camelot[2] looked good at first, but after testing this on different OSes made me think, that performance wise there is a lot of room for improvement. So far i have given flutter a wide berth because learning a new language (Dart) AND a new framework did not seem to fit my time capacities, but what I've read here makes me think, that even writing a simple cross platform app it is not worth the effort learning another C# UI technology, because they mostly get abandoned before they really mature. My personal conclusion: Use Flutter instead! Am I right? [1]: https://dev.to/avalonia/turning-it-up-to-11-34jn https://dev.to/avalonia/turning-it-up-to-11-34jn [2]: https://github.com/IngvarX/Camelot https://github.com/IngvarX/Camelot
- zigzag312 4y agoDart feels like a lite version of C#, so it shouldn't take you too long to learn. Performance wise Flutter too has room for improvement. Although, I don't know how Flutter's performance compares to Avalonia. Flutter, being young framework itself, is probably more mature than Avalonia, Uno or MAUI. Also, Flutter has very good documentation and learning materials and bigger community. When I'm working with Flutter I do miss more powerful C#, but I for sure don't miss XAML.
- sandreas 4y agoThanks for the impressions. I think I will try it out :-)
- Crank76 4y agoYou may want to take a look at Nevron Open Vision (https://www.nevron.com/products-open-vision.aspx https://www.nevron.com/products-open-vision.aspx). This is probably the most advanced desktop cross-platform application development framework around. I work for the company that created it and we have internally compared it to MAUI, Uno, Electron Qt etc. Nevron Open Vision is better in all aspects - it supports more controls, better integration and now also supports Blazor-WebAssembly! MyDraw is one commercial application built with it and tested by thousands of Windows and Mac users.
- Frontend_devs 4y agoNET and can be used to develop applications which run on Android and iOS.