Skip to content

Commit

Permalink
Fix previewer sometimes not finding deps file (#14552)
Browse files Browse the repository at this point in the history
  • Loading branch information
maxkatz6 committed Feb 9, 2024
1 parent 8434202 commit 0c4b19b
Showing 1 changed file with 11 additions and 1 deletion.
12 changes: 11 additions & 1 deletion src/tools/Avalonia.Designer.HostApp/DesignXamlLoader.cs
Original file line number Diff line number Diff line change
Expand Up @@ -30,7 +30,17 @@ private void PreloadDepsAssemblies(Assembly targetAssembly)
var depsJsonFile = Path.ChangeExtension(assemblyLocation, ".deps.json");
if (!File.Exists(depsJsonFile))
{
return;
var sameDir = Path.GetDirectoryName(depsJsonFile);
var fallbackDepsFiles = Directory.GetFiles(sameDir, "*.deps.json");
if (fallbackDepsFiles.Length == 1)
{
depsJsonFile = fallbackDepsFiles[0];
}
else
{
Console.WriteLine($".deps.json file \"{depsJsonFile}\" doesn't exist, it might affect previewer stability.");
return;
}
}

using var stream = File.OpenRead(depsJsonFile);
Expand Down

0 comments on commit 0c4b19b

Please sign in to comment.