Add options for specifying a minimum workload version requirement#25993
Add options for specifying a minimum workload version requirement#25993
Conversation
jonathanpeppers
left a comment
There was a problem hiding this comment.
Maybe @dsplaisted can comment on the general problem here? Targeting .NET 9 MAUI packages from a .NET 8 project would certainly default to netstandard2.0 if those exist.
@mattleibow why does Microsoft.Maui.Controls have netstandard2.0 assemblies inside at all? That is needed for MSBuild tasks inside Visual Studio, so you could simply have a copy of those in the Microsoft.Maui.Controls.Build.Tasks package? They shouldn't be referenced by customer projects, just used by the MSBuild tasks?
src/Core/src/nuget/buildTransitive/netstandard2.0/Microsoft.Maui.Core.targets
Outdated
Show resolved
Hide resolved
|
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. |
Do we know the answer to this question? MSBuild won't even know how to find these assemblies unless you use |
| - Installing a .NET 9 MAUI package into a .NET 8 project | ||
| - Installing a .NET 9 MAUI package into a very old .NET 9 installation | ||
|
|
||
| To skip this check, set $(SkipCheckForMauiMinimumSupportedWorkloadVersion) to true. |
There was a problem hiding this comment.
This will need some documentation heads up @davidortinau @rachelkang .
There was a problem hiding this comment.
Do we want to advertise this option? It will only cause pain, and I just added this as a failsafe just in case.
rmarinho
left a comment
There was a problem hiding this comment.
Should we add a test where we try to install this on a machine with net8 sdk only? I know it might be tricky. but I think that will cover this edge case works.
Also I think the message needs to be localized.
|
/rebase |
If we detect that you have installed .NET MAUI into a TFM which is not found in the package, then we will fail the build. The error code is MA003 and there is a property to skip this warning as well: Errors will look like: - error MA003: This version of .NET MAUI requires at least a TargetFramework of 'net9.0-windows10.0.19041.0', which is greater than the current TargetFramework 'net8.0-windows10.0.19041.0'. - error MA003: This version of .NET MAUI requires at least a TargetFramework of 'net9.0-ios', which is greater than the current TargetFramework 'net8.0-ios'. - error MA003: This version of .NET MAUI requires at least a TargetFramework of 'net9.0-maccatalyst17.0', which is greater than the current TargetFramework 'net8.0-maccatalyst17.0'.
This happens mostly in the maui repo, but also may happen if the build is not using workloads. This is not really possible outside of the maui repo source build.
39949fc to
69d009b
Compare
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:
Issues Fixed
Fixes #25970