diff --git a/src/tasks/AotCompilerTask/MonoAOTCompiler.cs b/src/tasks/AotCompilerTask/MonoAOTCompiler.cs index 12b4dafe6b467..e3ef51a9daa22 100644 --- a/src/tasks/AotCompilerTask/MonoAOTCompiler.cs +++ b/src/tasks/AotCompilerTask/MonoAOTCompiler.cs @@ -936,12 +936,6 @@ private bool PrecompileLibrary(PrecompileArguments args) bool copied = false; foreach (var proxyFile in args.ProxyFiles) { - if (!File.Exists(proxyFile.TempFile)) - { - Log.LogError($"Precompile command succeeded, but can't find the expected temporary output file - {proxyFile.TempFile} for {assembly}.{Environment.NewLine}{output}"); - return false; - } - copied |= proxyFile.CopyOutputFileIfChanged(); _fileWrites.Add(proxyFile.TargetFile); } @@ -1225,11 +1219,11 @@ public bool CopyOutputFileIfChanged() if (!_cache.Enabled) return true; + if (!File.Exists(TempFile)) + throw new LogAsErrorException($"Could not find the temporary file {TempFile} for target file {TargetFile}. Look for any errors/warnings generated earlier in the build."); + try { - if (!File.Exists(TempFile)) - throw new LogAsErrorException($"Could not find the temporary file {TempFile} for target file {TargetFile}. Look for any errors/warnings generated earlier in the build."); - if (!_cache.ShouldCopy(this, out string? cause)) { _cache.Log.LogMessage(MessageImportance.Low, $"Skipping copying over {TargetFile} as the contents are unchanged"); @@ -1246,6 +1240,7 @@ public bool CopyOutputFileIfChanged() } finally { + _cache.Log.LogMessage(MessageImportance.Low, $"Deleting temp file {TempFile}"); File.Delete(TempFile); } }