'.Net Maui - how to create a class library?

I am just trying to migrate an old Xamarin app to .Net Maui in VS2022 (17.1.6). I have created the base application, however I have an old class library (dll) that contains common code that is used by more than one app.

Can anyone tell me what project type I need to use to create what in old .net standard terms would be a shared class library (dll).

I've read through the online documentation (as far as I can find it) and the focus is on individual apps and does not seem to mention much about shared components (non-ui).

I have seen references to a template called a .Net Maui Class library, but nothing tangible that I can use.

In Visual Studio I can see there are individual libraries for each platform (IOS, Android, Windows) but I am not terribly keen on writing the same code multiple times for different platforms.

There is a class library project which seems like it may work, but it says MacOS rather than IOS in the description.

Regards



Solution 1:[1]

Thanks for the reply.

I updated to VS2022 17.2.0 Preview 5, and refreshed the Maui stuff from the VS Installer and I now have the Maui Class Library templates which does what I needed.

Solution 2:[2]

You can update your visual studio and get the Maui class library.

When I created a standard class library compatible with UWP, I however discovered that the Maui app can accept a .net core 6 class library.

With this, I can make the .net 6 class library reference (depend on) the .net Framework 2.0 class library and the code is properly referenced.

The problem becomes what can I do with a completely empty class Library? I wonder if I can squeeze in remote storage functions there? hmmm

Sources

This article follows the attribution requirements of Stack Overflow and is licensed under CC BY-SA 3.0.

Source: Stack Overflow

Solution Source
Solution 1 TwoSeven
Solution 2 Rikudou En Sof