diff --git a/Make.versions b/Make.versions index 3fb81fb45541..6d992a2e0201 100644 --- a/Make.versions +++ b/Make.versions @@ -71,6 +71,12 @@ WATCHOS_NUGET_OS_VERSION=11.0 MACOS_NUGET_OS_VERSION=15.0 MACCATALYST_NUGET_OS_VERSION=18.0 +# The following are the OS versions we first supported with the current .NET version. +# These versions must *not* change with minor .NET updates, only major .NET releases. +IOS_TARGET_PLATFORM_VERSION_LIBRARY=18.0 +TVOS_TARGET_PLATFORM_VERSION_LIBRARY=18.0 +MACOS_TARGET_PLATFORM_VERSION_LIBRARY=15.0 +MACCATALYST_TARGET_PLATFORM_VERSION_LIBRARY=18.0 # In theory we should define the default platform version if it's not specified in the TFM. The default should not change for a given .NET version: # * We release support for iOS 14.5 with .NET 6 @@ -100,6 +106,14 @@ MACCATALYST_NUGET_OS_VERSION=18.0 # So we've made the decision that the default target platform version is # always the latest target platform version. +# However, this turns out to be somewhat of a complication for library developers, +# because they typically don't need Xcode to build their projects, and if we auto- +# update their TargetPlatformVersion to the latest, then all their customers +# have to also update their workloads, which for some people end up being a rather +# nasty surprise (because with the above algorithm it happens without developer +# action). Thus we follow .NET's default platform version scheme for library projects: +# it won't change in minor .NET releases. + # # Here we list all the releases we support for each platform. diff --git a/dotnet/Makefile b/dotnet/Makefile index a11033872d0d..526778966c16 100644 --- a/dotnet/Makefile +++ b/dotnet/Makefile @@ -116,7 +116,8 @@ targets/Microsoft.$(1).Sdk.Versions.props: targets/Microsoft.Sdk.Versions.templa -e "s/@PLATFORM@/$(1)/g" \ -e "s/@NUGET_VERSION_NO_METADATA@/$$($(2)_NUGET_VERSION_NO_METADATA)/g" \ -e "s/@NUGET_VERSION_FULL@/$$($(2)_NUGET_VERSION_FULL)/g" \ - -e "s/@TARGET_PLATFORM_VERSION@/$$($(2)_NUGET_OS_VERSION)/g" \ + -e "s/@TARGET_PLATFORM_VERSION_EXE@/$$($(2)_NUGET_OS_VERSION)/g" \ + -e "s/@TARGET_PLATFORM_VERSION_LIBRARY@/$$($(2)_TARGET_PLATFORM_VERSION_LIBRARY)/g" \ -e "s/@CURRENT_BRANCH@/$$(CURRENT_BRANCH_SED_ESCAPED)/g" \ -e "s/@CURRENT_HASH_LONG@/$$(CURRENT_HASH_LONG)/g" \ -e 's*@VALID_RUNTIME_IDENTIFIERS@*$(foreach rid,$(3),\n\t\t<_XamarinValidRuntimeIdentifier Include="$(rid)" Platform="$(1)" />)*' \ diff --git a/dotnet/targets/Microsoft.Sdk.Versions.template.props b/dotnet/targets/Microsoft.Sdk.Versions.template.props index d77b1f8d68c0..500353a521ae 100644 --- a/dotnet/targets/Microsoft.Sdk.Versions.template.props +++ b/dotnet/targets/Microsoft.Sdk.Versions.template.props @@ -6,7 +6,8 @@ <_ShortPackageVersion>@NUGET_VERSION_NO_METADATA@ <_PackageVersion>@NUGET_VERSION_FULL@ - <_XamarinTargetPlatformVersion>@TARGET_PLATFORM_VERSION@ + <_XamarinTargetPlatformVersionExecutable>@TARGET_PLATFORM_VERSION_EXE@ + <_XamarinTargetPlatformVersionLibrary>@TARGET_PLATFORM_VERSION_LIBRARY@ <_XamarinIsPreviewRelease>@XCODE_IS_PREVIEW@ <_XamarinDotNetVersion>@DOTNET_TFM@ <_XamarinPackSuffix>@DOTNET_TFM@_@NUGET_OS_VERSION@ diff --git a/dotnet/targets/Xamarin.Shared.Sdk.TargetFrameworkInference.props b/dotnet/targets/Xamarin.Shared.Sdk.TargetFrameworkInference.props index 0f585a4db207..26c436cce75d 100644 --- a/dotnet/targets/Xamarin.Shared.Sdk.TargetFrameworkInference.props +++ b/dotnet/targets/Xamarin.Shared.Sdk.TargetFrameworkInference.props @@ -12,6 +12,7 @@ - $(_XamarinTargetPlatformVersion) + $(_XamarinTargetPlatformVersionExecutable) + $(_XamarinTargetPlatformVersionLibrary)