dotnet / maui

.NET MAUI is the .NET Multi-platform App UI, a framework for building native device applications spanning mobile, tablet, and desktop.
https://dot.net/maui
MIT License
22.26k stars 1.76k forks source link

Add options for specifying a minimum workload version requirement #25993

Open mattleibow opened 22 hours ago

mattleibow commented 22 hours ago

Description of Change

If we detect that you have installed .NET MAUI NuGet packages into an SDK which has some old version of the .NET MAUI workload, then we will fail the build.

The error code is MA003 and there is a property to skip this warning as well: $(SkipCheckForMauiMinimumSupportedWorkloadVersion)

Errors will look like:

error MA003: The current .NET MAUI package version 'NUGET_VERSION' requires the .NET MAUI workload version to be at least 'MIN_WORKLOAD_VERSION'. The current .NET MAUI workload version is 'CURRENT_WORKLOAD_VERSION'.

error MA003: The current .NET MAUI package version '9.0.10-dev' requires the .NET MAUI workload version to be at least '9.0.0'. The current .NET MAUI workload version is '8.0.83'.

Issues Fixed

Fixes #25970

rolfbjarne commented 20 hours ago

Wild idea: provide a net6.0 version of the assemblies that has:

[Obsolete ("This version of MAUI requires at least a TargetFramework of ...", IsError = true)]

on every API.

jonathanpeppers commented 11 minutes ago

@mattleibow why does Microsoft.Maui.Controls have netstandard2.0 assemblies inside at all?

Do we know the answer to this question? MSBuild won't even know how to find these assemblies unless you use AppDomain.AssemblyResolve. So, we probably have a copy of the netstandard2.0 assemblies in the Microsoft.Maui.Controls.Build.Tasks package.