Microsoft boosts its MVVM library with .NET Community Toolkit 8.0

To make it easier for .NET developers who don’t work on Windows, Microsoft ships the UI-independent APIs and wizards in a separate project, .NET Community Toolkit. This starts in version 8.0.0.

On August 4, Microsoft officially launched the .NET Community Toolkit, available on GitHub. If this first version is immediately numbered 8.0.0, it is because all the libraries in this toolbox come from the Windows Community Toolkit. The latter bundles a bespoke set of wizards, extensions, and controls that simplify the most common tasks for developers building UWP and .NET apps for Windows 10 and 11. Over time, the number of APIs targeting .NET framework without Windows-specific dependencies increased. Microsoft has therefore decided to separate them into a separate project so that they can evolve independently by targeting .NET developers who do not work on Windows, says a post from the Redmond publisher explaining the release of the .NET Community Toolkit. This is followed by a reorganization of the documentation, split into three resource kits: .NET Community, Windows Community Toolkit and .NET MAUI (multi-platform), explains Sergio Pedri, software engineer II at the editor who follows the project on GitHub .

Published and maintained by Microsoft, the .NET Community Toolkit is part of the .NET Foundation. The tools and APIs it brings together are agnostic to the chosen UI platform. It can be used to share code between UWP, WinUI 3, MAUI, WPF, Avalonia, Uno, etc. The APIs have no dependency on a runtime or a framework, assures its supplier. “These libraries are multi-target, from .NET Standard 2.0 to .NET 6”, specifies Sergio Pedri. They include CommunityToolkit.Common, CommunityToolkit.Mvvm (also called Microsoft MVVM Toolkit), CommunityToolkit.Diagnostics and CommunityToolkit.HighPerformance.

Faster MVVM source generators

The main component of the .NET Community Toolkit is the MVVM Toolkit (mode-view-view-model) library, which is used by the Microsoft Store and the Photos app, among others. Inspired by the MvvmLight library piloted by the developer Laurent Bugnion, it replaces it. Microsoft specifies in passing to have collaborated with the developer Laurent Bugnion – who supervises MvvmLight – the latter having “approved the MVVM Toolkit as the way forward for existing users of MvvmLight”. Migration documents are available on this point.

The main evolution of the MVVM Toolkit 8.0.0 are the new MVVM source generators which will significantly reduce the code required to configure an application using MVVM. Compared to those delivered in preview in version 7.1.0, they have been completely rewritten to make them incremental generators, which makes them faster and allows the development environment to be more responsive when working. on large-scale projects, says Microsoft. In his post, the editor describes the other novelties, among which the attribute [RelayCommand] which automates the generation of commands in MVVM Toolkit and attributes to create observable properties in the background. The source code is on GitHub and .Net Community Toolkit is of course on NuGet, the package manager for .NET.

Leave a Comment