diff --git a/src/Avalonia.DesignerSupport/DesignWindowLoader.cs b/src/Avalonia.DesignerSupport/DesignWindowLoader.cs index c649f934e6..211cab3d3e 100644 --- a/src/Avalonia.DesignerSupport/DesignWindowLoader.cs +++ b/src/Avalonia.DesignerSupport/DesignWindowLoader.cs @@ -12,7 +12,7 @@ namespace Avalonia.DesignerSupport { public class DesignWindowLoader { - public static Window LoadDesignerWindow(string xaml, string assemblyPath) + public static Window LoadDesignerWindow(string xaml, string assemblyPath, string xamlFileProjectPath) { Window window; Control control; @@ -26,9 +26,11 @@ namespace Avalonia.DesignerSupport Uri baseUri = null; if (assemblyPath != null) { + if (xamlFileProjectPath == null) + xamlFileProjectPath = "/Designer/Fake.xaml"; //Fabricate fake Uri baseUri = - new Uri($"res:asm:{Path.GetFileNameWithoutExtension(assemblyPath)}/Designer/Fake.xaml"); + new Uri($"res:asm:{Path.GetFileNameWithoutExtension(assemblyPath)}{xamlFileProjectPath}"); } var localAsm = assemblyPath != null ? Assembly.LoadFile(Path.GetFullPath(assemblyPath)) : null; diff --git a/src/Avalonia.DesignerSupport/Remote/RemoteDesignerEntryPoint.cs b/src/Avalonia.DesignerSupport/Remote/RemoteDesignerEntryPoint.cs index cf36dd622a..09196e4fb7 100644 --- a/src/Avalonia.DesignerSupport/Remote/RemoteDesignerEntryPoint.cs +++ b/src/Avalonia.DesignerSupport/Remote/RemoteDesignerEntryPoint.cs @@ -199,7 +199,7 @@ namespace Avalonia.DesignerSupport.Remote s_currentWindow = null; try { - s_currentWindow = DesignWindowLoader.LoadDesignerWindow(xaml.Xaml, xaml.AssemblyPath); + s_currentWindow = DesignWindowLoader.LoadDesignerWindow(xaml.Xaml, xaml.AssemblyPath, xaml.XamlFileProjectPath); s_transport.Send(new UpdateXamlResultMessage(){Handle = s_currentWindow.PlatformImpl?.Handle?.Handle.ToString()}); } catch (Exception e) diff --git a/src/Avalonia.Remote.Protocol/DesignMessages.cs b/src/Avalonia.Remote.Protocol/DesignMessages.cs index f3683da21c..f70bcef6b3 100644 --- a/src/Avalonia.Remote.Protocol/DesignMessages.cs +++ b/src/Avalonia.Remote.Protocol/DesignMessages.cs @@ -7,6 +7,7 @@ namespace Avalonia.Remote.Protocol.Designer { public string Xaml { get; set; } public string AssemblyPath { get; set; } + public string XamlFileProjectPath { get; set; } } [AvaloniaRemoteMessageGuid("B7A70093-0C5D-47FD-9261-22086D43A2E2")] @@ -22,4 +23,4 @@ namespace Avalonia.Remote.Protocol.Designer public string SessionId { get; set; } } -} \ No newline at end of file +}