From 65fef38e9f9065f9d0cd386f4a583bf81abb23ff Mon Sep 17 00:00:00 2001 From: Rolf Bjarne Kvinge Date: Fri, 10 Nov 2023 12:08:24 +0100 Subject: [PATCH] [dotnet] Store the .NET version we target in a generated props file. (#19416) This way we can avoid hardcoding the .NET version later in the build targets. --- dotnet/Makefile | 1 + dotnet/targets/Microsoft.Sdk.Versions.template.props | 1 + dotnet/targets/Xamarin.Shared.Sdk.targets | 2 +- 3 files changed, 3 insertions(+), 1 deletion(-) diff --git a/dotnet/Makefile b/dotnet/Makefile index e283f2f841..b6c512de54 100644 --- a/dotnet/Makefile +++ b/dotnet/Makefile @@ -119,6 +119,7 @@ targets/Microsoft.$(1).Sdk.Versions.props: targets/Microsoft.Sdk.Versions.templa -e 's/@DOTNET_TFM@/$(DOTNET_TFM)/g' \ -e 's/@RUNTIME_PACK_RUNTIME_IDENTIFIERS@/$(4)/g' \ -e 's/@XCODE_IS_PREVIEW@/$(XCODE_IS_PREVIEW)/g' \ + -e 's/@DOTNET_TFM@/$(DOTNET_TFM)/g' \ $$< > $$@.tmp $$(Q) mv $$@.tmp $$@ diff --git a/dotnet/targets/Microsoft.Sdk.Versions.template.props b/dotnet/targets/Microsoft.Sdk.Versions.template.props index 30a53269af..9189731295 100644 --- a/dotnet/targets/Microsoft.Sdk.Versions.template.props +++ b/dotnet/targets/Microsoft.Sdk.Versions.template.props @@ -8,6 +8,7 @@ <_PackageVersion>@NUGET_VERSION_FULL@ <_DefaultTargetPlatformVersion>@DEFAULT_TARGET_PLATFORM_VERSION@ <_XamarinIsPreviewRelease>@XCODE_IS_PREVIEW@ + <_XamarinDotNetVersion>@DOTNET_TFM@ @VALID_RUNTIME_IDENTIFIERS@ diff --git a/dotnet/targets/Xamarin.Shared.Sdk.targets b/dotnet/targets/Xamarin.Shared.Sdk.targets index 229d6c6b86..38ff29dd3a 100644 --- a/dotnet/targets/Xamarin.Shared.Sdk.targets +++ b/dotnet/targets/Xamarin.Shared.Sdk.targets @@ -964,7 +964,7 @@ <_XamarinRefPackageDirectory>%(_XamarinFrameworkReference.TargetingPackPath) <_XamarinNativeLibraryDirectory>$(_XamarinSdkRuntimePackDirectory)/runtimes/$(RuntimeIdentifier)/native <_XamarinIncludeDirectory>$(_XamarinSdkRuntimePackDirectory)/runtimes/$(RuntimeIdentifier)/native - <_XamarinRefAssemblyDirectory>$(_XamarinRefPackageDirectory)/ref/net8.0/ + <_XamarinRefAssemblyDirectory>$(_XamarinRefPackageDirectory)/ref/$(_XamarinDotNetVersion)/ <_XamarinRefAssemblyPath>$(_XamarinRefAssemblyDirectory)$(_PlatformAssemblyName).dll <_LibPartialStaticRegistrar Condition="'$(_XamarinRuntime)' == 'MonoVM'">$(_XamarinNativeLibraryDirectory)/Microsoft.$(_PlatformName).registrar.a