.NET 6 and Self-Contained Single File Apps

Another year, another .NET Core release. .NET 6 is now out and although it contains some new features, the main things I think are significant are the continued push for high performance and that it is an LTS release.

.NET 6 is supported until the 8ᵗʰ of November 2024. .NET 5 is only supported until the 8ᵗʰ of May 2022, earlier than the previous LTS version (.NET Core 3.1).

Self-contained single file apps that were only supported on Linux in .NET 5 are now available on Windows and macOS too. This means you can bundle the framework with your app so it doesn’t need to be installed. The published files are significantly bigger but you can trim out the bits that you aren’t using to make this more manageable and it’s going to be smaller than an electron app.

Self-contained apps are simpler than shipping a whole Docker container but I would still do this for server-side apps to make patching easier when all the apps can share the same official base image. I’ve been working a lot in Python recently and containers are very useful for ensuring that you have a consistent runtime environment.

There is a hot-reload feature too but this appears to be limited in scope so it is probably worth waiting a bit before using this for real. It looks like we will also have to wait until .NET 7 for ahead-of-time and native compilation, and until .NET 8 (i.e. a couple of years) for an LTS version of this feature.

A lot of the focus of .NET 6 appears to be on the MAUI (Multi-platform App UI) preview. This is the evolution of Xamarin and I did a few projects in this some years ago (including a mobile game I proposed to my now wife with, which I haven’t yet written about). Today I would go with React but at the time the Android support of React Native was severely lacking.

The benefits of being able to share code between a web app running in a browser and one running directly on a device outweigh the shortcomings of web tech. For example, VS Code now has a browser version for collaborating or exploring untrusted code in a sandboxed environment. VS Code uses TypeScript but there is also Blazor (a version of which compiles C# into WebAssembly). I’m not sure that Blazor is going to be the future though.

.NET is still a little clunky if you’re not using the full version of VS (or Rider). The command line and VS Code experience doesn’t quite feel first-class.

My more recent engagements have mainly involved Python, Django (using a PostgreSQL database) and Django REST framework to provide the Web APIs for React apps (although I’m keen to try out Graphene for GraphQL). This is a pretty good developer experience with VS Code (or PyCharm) but it’s worth having a separate terminal open as the built-in one can be pretty laggy. I find VS Code is also good for writing, indeed I write this blog in it using Markdown.

Would you like help solving a technology problem in your business?
Email me for a free consultation. I'm always open to new opportunities!

This blog is treeware! If you found it useful then please plant a tree.
Donate a treeDonate a tree🌳🌳