示例 MauiProgram:
public static class MauiProgram{public static MauiApp CreateMauiApp(){var builder = MauiApp.CreateBuilder();builder.UseMauiApp().ConfigureFonts(fonts =>{fonts.AddFont("OpenSans-Regular.ttf", "OpenSansRegular");});return builder.Build();}}安卓示例 MainApplication:
public class MainApplication : MauiApplication{public MainApplication(IntPtr handle, JniHandleOwnership ownership): base(handle, ownership){}protected override MauiApp CreateMauiApp() => MauiProgram.CreateMauiApp();}pull request:
https://github.com/dotnet/maui/pull/2137
安卓更新Android 12 (API 31) 现在是为 Android 构建的 .NET 6 应用程序的默认版本。要使用 Android 12,你需要手动安装 JDK 11。一旦微软更新 Visual Studio 中的 Android 工具以使用 JDK 11,微软将默认将此依赖项与 .NET MAUI 捆绑在一起。在此之前,JDK 11 可能会对 Android 设计器、SDK 管理器和设备管理器产生不利影响。
Android 项目现在默认使用 MaterialTheme。确保 Platforms/Android/MainActivity.cs 指定 @style/Maui.SplashTheme 否则你可能会在 Android 上遇到运行时错误。例如,查看更新的 .NET MAUI 模板。
手动安装 JDK 11:
https://github.com/xamarin/xamarin-android/wiki/JDK-11-Warning
更新的 .NET MAUI 模板:
https://github.com/dotnet/maui/blob/main/src/Templates/src/templates/maui-mobile/Platforms/Android/MainActivity.cs
其他变化其他值得注意的变化包括:
- MinHeightRequest、MaxHeightRequest、MinWidthRequest、MaxWidthRequest 已删除“Request”后缀,布局系统现在将它们视为真实值
- 将行为附加到任何控件映射器的简化方法 – #1859
- Shell 主题样式的各种改进
- 为 Android #2027 和 iOS #2029 添加了 RefreshView
- 添加绝对布局 #2136
- 添加了从右到左 (RTL) FlowDirection #948
- 添加 Button.Icon ImageSource #2079
https://github.com/dotnet/maui/pull/1859
#2027:
【 微软.|微软 .NET 跨平台 UI 框架 MAUI预览版8发布】https://github.com/dotnet/maui/pull/2027
#2029:
https://github.com/dotnet/maui/pull/2029
#2136:
https://github.com/dotnet/maui/pull/2136
#948:
https://github.com/dotnet/maui/pull/948
#2079:
https://github.com/dotnet/maui/pull/2079
准备好了吗?打开 Visual Studio 2022 并创建一个新项目。搜索并选择 .NET MAUI。

文章插图
有关 .NET MAUI 入门的更多信息,请参阅微软的文档。
文档:
https://docs.microsoft.com/zh-cn/dotnet/maui/get-started/installation
欢迎反馈Visual Studio 2022 正在快速启用 .NET MAUI 的新功能。当你在调试、部署和编辑器相关体验方面遇到任何问题时,请使用“帮助”>“发送反馈”菜单报告你的体验。
请通过 dotnet/maui 在 GitHub 上与微软互动,让微软了解你使用 .NET MAUI 创建新应用程序的体验。
要查看未来版本中的内容,请访问微软的产品路线图,要了解功能完整性的状态,请访问微软的状态 wiki。
dotnet/maui:
https://github.com/dotnet/maui
产品路线图:
https://github.com/dotnet/maui/wiki/roadmap
状态 wiki:
https://github.com/dotnet/maui/wiki/status
- 程序员|俄罗斯传来新消息,无法更新微软系统,国产操作系统崛起的机会?
- 微软|死心塌地的送快递12年:京东001号快递员金宜财,刘强东给了他什么
- 近几个月|微软发文称edge是“最适合游戏玩家的浏览器”
- 虽然对于微软来说|微软确认windows1022h2功能更新
- 卫报|元宇宙、虚拟数字人,微软等科技巨头布局行业标准,中国也在行动
- 微软|PCI-E 7.0降临!带宽再翻一倍,但产品要2025年才上市
- 智能手表|微软:俄罗斯对援乌42国发动黑客攻击 目标的成功率为29%
- 浏览器|省了一台Xbox!微软确认:Edge将内置云游戏和经典小游戏
- 微软|微软报告:限流也没用,俄罗斯媒体在美乌两国访问量猛增
- 美团|曾坐拥4亿铁粉,如今无人问津!微软最牛的儿子,沦为全球笑柄?
