From 0aba3edd5ef576f75bd5bb96b6206234a0defef9 Mon Sep 17 00:00:00 2001 From: Julien Lebosquain <julien@lebosquain.net> Date: Fri, 15 Mar 2024 02:55:25 +0100 Subject: [PATCH] Fix NativeAOT not using the XAML compilation output (#14966) --- packages/Avalonia/AvaloniaBuildTasks.targets | 15 +++++++++++++++ 1 file changed, 15 insertions(+) diff --git a/packages/Avalonia/AvaloniaBuildTasks.targets b/packages/Avalonia/AvaloniaBuildTasks.targets index 89e2474a9c1..88a6403e009 100644 --- a/packages/Avalonia/AvaloniaBuildTasks.targets +++ b/packages/Avalonia/AvaloniaBuildTasks.targets @@ -161,6 +161,21 @@ <_DebugSymbolsIntermediatePath Include="@(_AvaloniaXamlCompiledSymbols)"/> </ItemGroup> </Target> + + <!-- For some reason the IL Compiler hardcodes $(IntermediateOutputPath)$(TargetName)$(TargetExt) instead of using @(IntermediateAssembly), change that to our assembly. --> + <Target Name="InjectIlcAvaloniaXamlOutput" + DependsOnTargets="InjectAvaloniaXamlOutput" + AfterTargets="ComputeIlcCompileInputs" + BeforeTargets="PrepareForILLink" + Condition="'@(AvaloniaResource)@(AvaloniaXaml)' != '' AND $(EnableAvaloniaXamlCompilation) != false"> + <ItemGroup> + <ManagedBinary Remove="$(IntermediateOutputPath)$(TargetName)$(TargetExt)" /> + <ManagedBinary Include="@(_AvaloniaXamlCompiledAssembly)" /> + + <IlcCompileInput Remove="$(IntermediateOutputPath)$(TargetName)$(TargetExt)" /> + <IlcCompileInput Include="@(_AvaloniaXamlCompiledAssembly)" /> + </ItemGroup> + </Target> <Target Name="Avalonia_CollectUpToDateCheckOutputDesignTime" Condition="'@(AvaloniaResource)@(AvaloniaXaml)' != '' AND $(EnableAvaloniaXamlCompilation) != false" BeforeTargets="CollectUpToDateCheckOutputDesignTime" DependsOnTargets="PrepareToCompileAvaloniaXaml">