You need to enable JavaScript to run this app.
优惠活动
大模型
产品
解决方案
定价
更多

从Xamarin迁移至.NET 8 Maui遇'Normal'枚举未找到错误求助

解决.NET MAUI迁移中“Enum value not found for "Normal"”错误
  • 全局搜索定位问题代码:
    用Visual Studio的Ctrl+Shift+F打开全局查找,输入"Normal",筛选.xaml文件,重点查看App.xaml里的所有匹配项,包括按钮属性、全局样式定义。
  • 检查按钮的FontAttributes属性:
    Xamarin里Button的FontAttributes枚举包含Normal值,但.NET MAUI中该值被替换为None。如果App.xaml里有<Button FontAttributes="Normal" .../>这类代码,直接修改为<Button FontAttributes="None" .../>。
  • 排查全局样式中的枚举引用:
    若App.xaml里定义了全局按钮样式(比如<Style x:Key="ButtonStyle" TargetType="Button">),查看样式内是否存在FontAttributes="Normal"的设置,同样替换为None。
  • 分段注释排查:
    要是仍无法定位,就把App.xaml里的内容分段注释(比如先注释所有资源字典,再注释启动页设置),每次编译验证,逐步锁定出错的代码行。

内容的提问来源于stack exchange,提问作者James farmer

相关产品推荐
方舟 Agent Plan

超全模态模型 × Harness 升级,最新支持 Deepseek-V4.1-Flash、GLM-5.3 系列、Doubao-Seedream-5.0-pro、Kimi-K3 (部分), 限时 9.9 元起

最近更新时间:2026.06.27 17:54:50