[msbuild] Fix the FindAotCompiler task for .NET 7. (#15759)

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.
This commit is contained in:
Rolf Bjarne Kvinge 2022-08-26 08:07:20 +02:00 коммит произвёл GitHub
Родитель 5db2302809
Коммит b2c10aab23
Не найден ключ, соответствующий данной подписи
Идентификатор ключа GPG: 4AEE18F83AFDEB23
1 изменённых файлов: 2 добавлений и 2 удалений

Просмотреть файл

@ -20,7 +20,7 @@ namespace Xamarin.MacDev.Tasks {
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 @@ namespace Xamarin.MacDev.Tasks {
var csproj = $@"<?xml version=""1.0"" encoding=""utf-8""?>
<Project Sdk=""Microsoft.NET.Sdk"">
<PropertyGroup>
<TargetFramework>net6.0-{PlatformName}</TargetFramework>
<TargetFramework>net{TargetFramework.Version}-{PlatformName}</TargetFramework>
</PropertyGroup>
<Target Name=""ComputeAotCompilerPath"">
<PropertyGroup>