-
Notifications
You must be signed in to change notification settings - Fork 1.8k
New issue
Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.
By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.
Already on GitHub? Sign in to your account
Add options for specifying a minimum workload version requirement #25993
base: main
Are you sure you want to change the base?
Conversation
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'.
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
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?
<Error | ||
Code="MA003" | ||
Text="This version of .NET MAUI requires at least a TargetFramework of '$(_MauiMinimumTargetFrameworkString)', which is greater than the current TargetFramework '$(TargetFramework)'." /> |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Can we go ahead and setup this message for localization?
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Not sure we have that infrastructure. @tj-devel709 what can we localize?
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
We should at least create a <MauiError/>
task and start putting these strings in .resx
files. We have examples in the dotnet/android repo.
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
OK, I'll have a look. But, that we can do in a separate PR and I can go through the targets and collect the errors, warnings and messages.
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. |
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.
Do we know the answer to this question? MSBuild won't even know how to find these assemblies unless you use |
<None Include="nuget\**" Exclude="nuget\**\*.in.*" PackagePath="" Pack="true" /> | ||
<None Remove="nuget\**" /> | ||
<None Include="nuget\**" Exclude="nuget\**\*.in.*;nuget\**\net-windows\*" PackagePath="" Pack="true" /> | ||
<None Include="nuget\buildTransitive\net-windows\**" PackagePath="buildTransitive\net$(_MauiMinimumSupportedDotNetTfm)-windows$(MinimumWindowsTargetFrameworkVersion)" Pack="true" /> |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Can you add more context on what this change is doing?
@@ -3,7 +3,7 @@ | |||
<ImportGroup Condition="Exists('$(_MauiBuildTasksLocation)Microsoft.Maui.Controls.Build.Tasks.dll') and Exists('$(_MauiBuildTasksLocation)Microsoft.Maui.Resizetizer.dll')"> | |||
|
|||
<!-- Microsoft.Maui.Core.props --> | |||
<Import Project="$(_MauiBuildTasksLocation)net6.0-windows10.0.17763.0\Microsoft.Maui.Core.props" Condition="'$(_MauiTargetPlatformIsWindows)' == 'true'" /> | |||
<Import Project="$(_MauiBuildTasksLocation)net$(_MauiMinimumSupportedDotNetTfm)-windows$(MinimumWindowsTargetFrameworkVersion)\Microsoft.Maui.Core.props" Condition="'$(_MauiTargetPlatformIsWindows)' == 'true'" /> |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Ahh so we used to just keep this very low, now we're setting it to what we know to be the min supported version
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