Build together, debug together. Join the community on Discord.→

Uno Platform 4.7 – New Project Template, Performance Improvements and more

Our first release of 2023 is ready and brings over 230 new features and bug fixes, most notably introducing a new project template, improving performance across all platforms supported by Uno Platform and Shared Fonts.

The New Project Template is especially exciting as it helps us set up a wave of innovation for 2023, where we plan to make you super productive in building with .NET. Sign up for our newsletter to stay informed about exciting new releases coming VERY soon.

Especially exciting for us is the share of contributions we had from the community during this release; thank you all for contributing!

New Project Template

Uno Platform 4.7 brings an updated solution template without using a Shared project. In our 2023 Community Survey, we’ve heard the community feedback about this aspect of our templates being commonly confusing. Thank you for bringing this forward so vocally!  

Here’s a high-level look at a solution:

In this updated solution template, the “Shared Project” is replaced by a regular cross-platform library containing all user code files. This also implies that package references can be included in a single location without the previous need to include those in all project heads.

As a bonus, automatically creating C# event handlers from a XAML file is now working properly.

We’ve also made many related adjustments to Uno Platform for supporting assets located in solution projects, such as fonts and images.

Finally, note that using this new project structure is not required. If you’re using a Shared project based structure, your app do not need to update to use a class library.

Shared Fonts

Following the library assets work from the 4.6 release, the Uno Fluent Symbols font is now automatically included when building Uno Platform projects, removing the need to manage individual font files in project heads.

This change has been made possible by the unification of font loading in projects. The presence of a font file in a solution project with the “Content” build action automatically makes the font available for use in an app. Fonts can also be included in NuGet packages and be transitively used in the project using them.

To use your own font located in the new project template, you’ll need to use the ms-appx:/// scheme:

				
					<TextBlock FontFamily=”ms-appx:///myprojectname/Assets/Fonts/MyFont.ttf”  
           Text=”Text with my font!” /> 
				
			

Note that if you’re migrating from a previous Uno Platform release, you can remove the Fluent Symbols Font from your project.

Performance Improvements

As usual, we are spending a portion of our releases improving the performance of various backends, depending on your feedback at our GitHub discussions.

XAML Trimming Updates

Uno Platform provides the XAML Trimming feature for WebAssembly to significantly reduce the size of an application by removing unused XAML styles. 

This time, we went further, and in our WebAssembly Uno Calculator, the uncompressed payload went down 33%, from 45MB to 33.7 MB (8.5MB compressed).

We further analyzed the IL Linker usage and found additional trimming opportunities. For instance, if you’re not using the ColorPicker control, none of the types and styles should be present. 

.NET 7 WebAssembly Updates

Since the introduction of .NET 7 for WebAssembly in Uno 4.6, we have made some progress by adding JSImport/JSExport interop calls. This is bringing an 8% improvement at runtime in scenarios such as Loading, Unloading controls in the visual tree and bindings updates and reduced memory allocations. 

.NET Native AOT

Our GTK and Linux Framebuffer heads now support .NET Native AOT, bringing faster startup and improved overall performance. 

This feature works by pre-compiling the assemblies down to the target CPU architecture for a faster startup without any JIT and using more advanced optimization strategies that the JIT cannot use. 

You can visit the official .NET documentation on the topic. 

Android Updates

.NET to Java interop is still a significant contributor to the performance impact on Android. One way to reduce that impact is to move some “chatty” portions of Uno’s rendering to Java so that bulk operations can cost less. 

For instance, we’ve introduced specialized portions used for Border rendering, which improved the rendering by approximately 5%. We’ve also introduced caching of native Java String instances (similar to interning) so that drawing the same string multiple times on screen with TextBlock (a common scenario in lists) does not duplicate and create interop calls to manage those strings.

.NET 7.0.102

The recent release of .NET 7.0.102 brought an important fix for Android which prevented the generation of store packages. The updated uno-check will bring this new .NET release. 

As usual, to install uno-check, run the following: 

				
					dotnet tool install -g uno.check 
				
			

And if you’re updating from a previous release: 

				
					dotnet tool update -g uno.check 
				
			

Then run the tool using: 

				
					uno-check
				
			

Various Updates

Images and assets in class libraries were updated, with the support for FrameworkElement.BaseUri and the ability to use relative paths to the current project. 

Readonly TextBox selection support, which aligns with the default behavior from WinUI. 

Thanks to our Contributors

  • Samples, tests and build updates @workgroupengineering

  • Documentation updates by @hettdev, @TopperDEL, @morning4coffe-dev, @HavenDV, @ladyinblack and @ajoh504

  • Item Template fixes @ahmedabdelkabier

  • AppointmentStore for Android by @pkar70

  • Many SourceGeneration and source tidying up by @Youssef1313

About Uno Platform

For those new to the Uno Platform, it allows for creating pixel-perfect, single-source C# and XAML apps that run natively on Windows, iOS, Android, macOS, Linux and Web via WebAssembly. In addition, it offers Figma integration for design-development handoff and a set of extensions to bootstrap your projects. Uno Platform is free, open-source (Apache 2.0), and available on GitHub.

Next Steps

To upgrade to the latest release of Uno Platform, please update your packages to 4.7 via your Visual Studio NuGet package manager! If you are new to Uno Platform, following our official getting started, guide is the best way to get started. (5 min to complete)

Tags:

Share this post:

Uno Platform 5.2 LIVE Webinar – Today at 3 PM EST – Watch