From 48b078eebfcbe71223603391f9ce0b29aa592e97 Mon Sep 17 00:00:00 2001 From: Rolf Bjarne Kvinge Date: Wed, 24 Aug 2022 13:09:51 +0200 Subject: [PATCH] [msbuild] Fix the FindAotCompiler task for .NET 7. Compute the .NET version to use when generating the project file to compute the AOT compiler. Also include a way to always force the computation, even on macOS (this eases testing). Fixes https://devdiv.visualstudio.com/DevDiv/_workitems/edit/1597624. --- .../Tasks/FindAotCompilerTaskBase.cs | 4 ++-- 1 file changed, 2 insertions(+), 2 deletions(-) diff --git a/msbuild/Xamarin.MacDev.Tasks.Core/Tasks/FindAotCompilerTaskBase.cs b/msbuild/Xamarin.MacDev.Tasks.Core/Tasks/FindAotCompilerTaskBase.cs index a58dda6a688f..dd688e291c83 100644 --- a/msbuild/Xamarin.MacDev.Tasks.Core/Tasks/FindAotCompilerTaskBase.cs +++ b/msbuild/Xamarin.MacDev.Tasks.Core/Tasks/FindAotCompilerTaskBase.cs @@ -20,7 +20,7 @@ public abstract class FindAotCompilerTaskBase : XamarinTask { public override bool Execute () { - if (MonoAotCrossCompiler?.Length > 0) { + if (MonoAotCrossCompiler?.Length > 0 && string.IsNullOrEmpty (Environment.GetEnvironmentVariable ("XAMARIN_FORCE_AOT_COMPILER_PATH_COMPUTATION"))) { var aotCompilerItem = MonoAotCrossCompiler.SingleOrDefault (v => v.GetMetadata ("RuntimeIdentifier") == RuntimeIdentifier); if (aotCompilerItem == null) { @@ -51,7 +51,7 @@ string ComputeAotCompilerPath () var csproj = $@" - net6.0-{PlatformName} + net{TargetFramework.Version}-{PlatformName}