3

We currently just started to write class libraries in .NET Standard so we can use this for WPF, Winforms and .Net Core with Ubuntu Server (but then without GUI). .Net 5 does not support Winforms or WPF for our .NET 4.6.x applications.

My question is, will .NET MAUI be compatible with .NET Standard 2.0 class libraries?

When I look at the .NET Standard website its says compatibility with .NET 6.0, but I can't find if that also the .NET MAUI framework.

https://dotnet.microsoft.com/platform/dotnet-standard#versions

Michiel
  • 67
  • 1
  • 6
  • 6
    As far as I'm aware, MAUI will run on .NET 6 - which means that it can consume .NET Standard 2.0 libraries. There doesn't need to be a separate compatibility line for every web framework and every GUI framework. Oh, and .NET 5 *does* support WinForms and WPF, but only on Windows. – Jon Skeet Sep 23 '21 at 12:50
  • 2
    .NET MAUI is a framework, not a runtime. The runtime is .NET 6. Unless you intend to target .NET Framework 4.x though, you should prefer .NET Standard 2.1. – Panagiotis Kanavos Sep 23 '21 at 12:51
  • Also note that in https://devblogs.microsoft.com/dotnet/update-on-dotnet-maui/, it talks about "native client apps for Windows, macOS, iOS, and Android" - not Linux. So I'm not sure where that leaves you in terms of Ubuntu Server. – Jon Skeet Sep 23 '21 at 12:52

1 Answers1

6

My question is, will .NET MAUI be compatible with .NET Standard 2.0 class libraries?

Yes, because, as it was mentioned in comments, .NET MAUI is just a library. You don't compile with MAUI, but rather with .NET 6.
All .NET Core versions starting from 2.0 can reference .NET Standard 2.0 libraries, and since .NET 6 is just a rename of what would be .NET Core 5, that is certainly possible.

The problem, however, is here:

We currently just started to write class libraries in .NET Standard so we can use this for WPF, Winforms and .Net Core with Ubuntu Server. .Net 5 does not support Winforms or WPF.

You can't use WPF nor Winforms in Linux/MacOS. You also can't use .NET MAUI in Linux as there is (currently) no target for that environment. The desktop environments supported are the same as for Xamarin: Windows and MacOS.

Notice that it was mentioned here that support for Linux is being considered for .NET 7, which should be released in around a year.

Camilo Terevinto
  • 31,141
  • 6
  • 88
  • 120
  • 1
    Thank you for your explanation. We dont want to use a GUI for Ubuntu Server, because there is just CLI. But when possible we would like to write our gui-less class libraries cross-platform. .Net 5 did not work with WPF / Winforms on .Net Framework 4.6.2 for instance, so that why we went to .Net Standard 2.0 – Michiel Sep 24 '21 at 13:06
  • @Michiel But... MAUI is a UI library. If you don't want an UI, you can just use a Console app, which will work on Ubuntu Server with any .NET Core version – Camilo Terevinto Sep 24 '21 at 13:07
  • 1
    I know, but we do want a GUI for our Windows / Android / iOS applications, perhaps MacOS and Linux when it gets supported. So writing non-gui code we can reuse is what im after. Thats why I write in .Net Standard 2.0 atm – Michiel Sep 25 '21 at 16:50
  • @Michiel That... doesn't make sense. You can write the non-UI code in any .NET Core version (including .NET 5/.NET 6) and it will work in Linux. Limiting yourself to the outdated .NET Standard 2.0 gives you no benefit – Camilo Terevinto Sep 25 '21 at 17:00
  • 1
    @CamiloTerevinto it makes sense to have your class libraries in .Net Standard 2.0 to support .Net Framework & .Net Core when he has projects from both. It makes more sense than abandoning the DRY principal in most cases. The time saved by maintaining one code base for shared logic will give him more time to spend on migrating old .Net Framework projects to .Net 5/6. – Daniel P May 09 '22 at 15:42
  • wrong, it's .NET 6-Android etc. if you are compiling it for Android. It's only getting confusing when it's advertised that .NET MAUI can do everything that .NET 6 can but that is wrong because it's limited to what .NET 6-Android can do. – user3625699 Sep 07 '22 at 12:28