-
Notifications
You must be signed in to change notification settings - Fork 511
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
Ensure MinimumOSVersion
is is consistent withSupportedOSPlatformVersion
#12336
Comments
It appears we do emit the |
|
+1, while painful on migration it is a one time thing instead of the can of worms of option 2 |
Yes, the spec originally recommended this It would be much better if MSBuild had a clean, consistent way to specify per-TFM and per-platform property values. It might look something like this: <!-- this kind of platform condition doesn't actually exist -->
<PropertyGroup Platform="ios">
<SupportedOSPlatformVersion>13.0<SupportedOSPlatformVersion>
</PropertyGroup> Unfortunately, this kind of simple platform condition does not exist today. There were several discussions on this topic but we did not settle upon a solution. So right now there isn't a good option for this. If you tried to do a condition like this with MSBuild today, you might try something like this: <!-- this kind of platform condition cannot be used for properties in a csproj -->
<PropertyGroup Condition="'$(TargetPlatformIdentifier)'=='ios'">
<SupportedOSPlatformVersion>13.0<SupportedOSPlatformVersion>
</PropertyGroup> This platform condition is indeed valid, but only works in some places. It doesn't work for properties and property groups in a csproj, but does work in most targets files. This is because the Somewhat confusingly, the So how do you do it for real? The "correct" way is this incredibly ugly and difficult to read condition: <!-- this platform condition is correct but ugly -->
<PropertyGroup Condition="'$([MSBuild]::GetTargetPlatformIdentifier("$(TargetFramework)"'))'=='ios'">
<SupportedOSPlatformVersion>13.0<SupportedOSPlatformVersion>
</PropertyGroup> Checking the verbatim <!-- this platform condition is correct but fragile -->
<PropertyGroup Condition="'$(TargetFramework)'=='net6.0-ios15.0'">
<SupportedOSPlatformVersion>13.0<SupportedOSPlatformVersion>
</PropertyGroup> Right now, in my own projects I'd would probably define <!-- this platform condition is correct, and limits ugliness to one line -->
<PropertyGroup>
<TargetFrameworks>net6.0;net6.0-android;net6.0-ios</TargetFrameworks>
<TargetPlatformIdentifier Condition="'$(TargetFramework)'==''">$([MSBuild]::GetTargetPlatformIdentifier("$(TargetFramework)")</TargetPlatformIdentifier>
</PropertyGroup>
<PropertyGroup Condition="'$(TargetPlatformIdentifier)'=='ios'">
<SupportedOSPlatformVersion>13.0<SupportedOSPlatformVersion>
</PropertyGroup>
<PropertyGroup Condition="'$(TargetPlatformIdentifier)'=='android'">
<SupportedOSPlatformVersion>13.0<SupportedOSPlatformVersion>
</PropertyGroup> Obviously this isn't something we'd want projects to have to do. We might have to just go with the pattern, at least for now. /cc @richlander @KathleenDollard @Redth @dsplaisted @terrajobst @rainersigwald |
What does |
@dsplaisted yeah there's some overloading going on here.
|
I see. In that case I would suggest this option, or something similar:
|
This was [at least to some extent] addressed with #12516. |
* Add support for the SupportedOSPlatformVersion MSBuild property, and write it to the Info.plist for the corresponding minimum OS version. * If there are any minimum OS version in the Info.plist, and show an error if it doesn't match SupportedOSPlatformVersion. This unfortunately means that if there's any minimum OS version in any Info.plist, then that will most likely have to be moved to the SupportedOSPlatformVersion property (or removed entirely if that's the right choice), since it's unlikely to match the default value for SupportedOSPlatformVersion. However, this was deemed to be the best option for the future (it's a one-time pain during migration). Fixes xamarin#12336.
I've added a PR that implements support for SupportedOSPlatformVersion, where it writes it to the Info.plist: #12638. If there are any existing values in the Info.plist, then we'll show an error if the two values don't match. That's basically my suggestion here: #12336 (comment), except that it doesn't support platform-specific properties. |
…to the PartialAppManifest item group in their own targets. Fixes xamarin#12336. Also add a test. Fixes xamarin#12336 (for the second time).
* Add support for the SupportedOSPlatformVersion MSBuild property, and write it to the Info.plist for the corresponding minimum OS version. * If there are any minimum OS version in the Info.plist, we'll now show an error if it doesn't match SupportedOSPlatformVersion. This unfortunately means that if there's any minimum OS version in any Info.plist, then that will most likely have to be moved to the SupportedOSPlatformVersion property (or removed entirely if that's the right choice), since it's unlikely to match the default value for SupportedOSPlatformVersion. However, this was deemed to be the best option for the future (it's a one-time pain during migration). Also add new tests, update existing tests, and update the templates. Fixes #12336.
@Redth @jonathanpeppers @mattleibow this change will probably affect existing MAUI tests, since existing projects will have to move any min OS version in the Info.plist to the |
I made a similar change on Android for this: dotnet/android@a66013b Maybe we need to do something for dotnet/maui singleproject for this? Maybe dotnet/maui's MSBuild targets should supply the minimum OS versions by default, so you don't have to put them in the |
You don't have to add them to the |
@rolfbjarne what's the value we should put on |
@rmarinho try |
I also notice that 13 is also missing :( |
We should ensure that the
MinimumOSVersion
property in the Info.plist is consistent with theSupportedOSPlatformVersion
MSBuild property.SupportedOSPlatformVersion
is a standardized across platforms and controls the SDK's platform analyzers.https://github.com/dotnet/designs/search?q=SupportedOSPlatformVersion
A few options:
MinimumOSVersion
property and theSupportedOSPlatformVersion
MSBuild property do not matchSupportedOSPlatformVersion
MSBuild property into theMinimumOSVersion
plist value during app buildSupportedOSPlatformVersion
MSBuild property from theMinimumOSVersion
plist property in a build target at start of build. the downside would be that it would not be available during evaluation.The text was updated successfully, but these errors were encountered: