diff --git a/packages/Avalonia/AvaloniaBuildTasks.targets b/packages/Avalonia/AvaloniaBuildTasks.targets index ca2d4b66ed..33f22f4d02 100644 --- a/packages/Avalonia/AvaloniaBuildTasks.targets +++ b/packages/Avalonia/AvaloniaBuildTasks.targets @@ -48,8 +48,12 @@ + + <_AvaloniaResourcesInputsCacheFilePath>$(IntermediateOutputPath)/Avalonia/Resources.Inputs.cache + + - + @@ -57,7 +61,11 @@ - + + + + + - + + + + @@ -103,6 +114,9 @@ File="$(AvaloniaXamlReferencesTemporaryFilePath)" Lines="@(ReferencePathWithRefAssemblies)" Overwrite="true" /> + + + + DefaultCompileBindings="$(AvaloniaUseCompiledBindingsByDefault)"> + + diff --git a/src/Avalonia.Build.Tasks/CompileAvaloniaXamlTask.cs b/src/Avalonia.Build.Tasks/CompileAvaloniaXamlTask.cs index fd07e0a143..3bd1ce5ce7 100644 --- a/src/Avalonia.Build.Tasks/CompileAvaloniaXamlTask.cs +++ b/src/Avalonia.Build.Tasks/CompileAvaloniaXamlTask.cs @@ -1,4 +1,5 @@ using System; +using System.Collections.Generic; using System.IO; using System.Linq; using Microsoft.Build.Framework; @@ -10,9 +11,10 @@ namespace Avalonia.Build.Tasks public bool Execute() { Enum.TryParse(ReportImportance, true, out MessageImportance outputImportance); + var writtenFilePaths = new List(); - OutputPath = OutputPath ?? AssemblyFile; - RefOutputPath = RefOutputPath ?? RefAssemblyFile; + OutputPath ??= AssemblyFile; + RefOutputPath ??= RefAssemblyFile; var outputPdb = GetPdbPath(OutputPath); var input = AssemblyFile; var refInput = RefOutputPath; @@ -21,8 +23,9 @@ namespace Avalonia.Build.Tasks if (OriginalCopyPath != null) { var originalCopyPathRef = Path.ChangeExtension(OriginalCopyPath, ".ref.dll"); - + File.Copy(AssemblyFile, OriginalCopyPath, true); + writtenFilePaths.Add(OriginalCopyPath); input = OriginalCopyPath; File.Delete(AssemblyFile); @@ -30,6 +33,7 @@ namespace Avalonia.Build.Tasks { var copyPdb = GetPdbPath(OriginalCopyPath); File.Copy(inputPdb, copyPdb, true); + writtenFilePaths.Add(copyPdb); File.Delete(inputPdb); inputPdb = copyPdb; } @@ -39,6 +43,7 @@ namespace Avalonia.Build.Tasks // We also copy ref assembly just for case if needed later for testing. // But do not remove the original one, as MSBuild actually complains about it with multi-thread compiling. File.Copy(RefAssemblyFile, originalCopyPathRef, true); + writtenFilePaths.Add(originalCopyPathRef); refInput = originalCopyPathRef; } } @@ -53,13 +58,25 @@ namespace Avalonia.Build.Tasks ProjectDirectory, VerifyIl, DefaultCompileBindings, outputImportance, (SignAssembly && !DelaySign) ? AssemblyOriginatorKeyFile : null, SkipXamlCompilation, DebuggerLaunch); if (!res.Success) + { + WrittenFilePaths = writtenFilePaths.ToArray(); return false; + } + if (!res.WrittenFile) { File.Copy(input, OutputPath, true); - if(File.Exists(inputPdb)) + if (File.Exists(inputPdb)) File.Copy(inputPdb, outputPdb, true); } + else if (!string.IsNullOrWhiteSpace(RefOutputPath) && File.Exists(RefOutputPath)) + writtenFilePaths.Add(RefOutputPath); + + writtenFilePaths.Add(OutputPath); + if (File.Exists(outputPdb)) + writtenFilePaths.Add(outputPdb); + + WrittenFilePaths = writtenFilePaths.ToArray(); return true; } @@ -103,5 +120,8 @@ namespace Avalonia.Build.Tasks public ITaskHost HostObject { get; set; } public bool DebuggerLaunch { get; set; } + + [Output] + public string[] WrittenFilePaths { get; private set; } = Array.Empty(); } }