diff --git a/src/tasks/AotCompilerTask/MonoAOTCompiler.cs b/src/tasks/AotCompilerTask/MonoAOTCompiler.cs index ab27947c15a7a2..f19da50dae47f0 100644 --- a/src/tasks/AotCompilerTask/MonoAOTCompiler.cs +++ b/src/tasks/AotCompilerTask/MonoAOTCompiler.cs @@ -111,7 +111,7 @@ public class MonoAOTCompiler : Microsoft.Build.Utilities.Task /// /// File to use for profile-guided optimization, *only* the methods described in the file will be AOT compiled. /// - public string? AotProfilePath { get; set; } + public string[]? AotProfilePath { get; set; } /// /// List of profilers to use. @@ -219,10 +219,16 @@ public override bool Execute() return false; } - if (!string.IsNullOrEmpty(AotProfilePath) && !File.Exists(AotProfilePath)) + if (AotProfilePath != null) { - Log.LogError($"'{AotProfilePath}' doesn't exist.", nameof(AotProfilePath)); - return false; + foreach (var path in AotProfilePath) + { + if (!File.Exists(path)) + { + Log.LogError($"AotProfilePath '{path}' doesn't exist."); + return false; + } + } } if (UseLLVM) @@ -491,9 +497,13 @@ private bool PrecompileLibrary(ITaskItem assemblyItem, string? monoPaths) aotAssembly.SetMetadata("AotDataFile", aotDataFile); } - if (!string.IsNullOrEmpty(AotProfilePath)) + if (AotProfilePath?.Length > 0) { - aotArgs.Add($"profile={AotProfilePath},profile-only"); + aotArgs.Add("profile-only"); + foreach (var path in AotProfilePath) + { + aotArgs.Add($"profile={path}"); + } } // we need to quote the entire --aot arguments here to make sure it is parsed