avalonia在linux下运行出现Default font family name can't be null or empty的错误,是因为Avalonia 无法确定或找不到默认的字体名,可以先在控制台打命令确定本机安装字体
fc-list
然后在avalonia项目的program.cs中增加此代码:
public static AppBuilder BuildAvaloniaApp() { FontManagerOptions options = new FontManagerOptions() { DefaultFamilyName = "Microsoft YaHei" }; return AppBuilder.Configure<App>() .UsePlatformDetect() .LogToTrace() .With(options); }
运行即可解决问题。