xamarin
Compare original and translation side by side
🇺🇸
Original
English🇨🇳
Translation
ChineseXamarin (Legacy)
Xamarin(遗留框架)
⚠️ STATUS: END OF LIFE (May 2024)
Xamarin has officially reached End of Support. It was a cross-platform framework for building Android/iOS apps with .NET and C#. All active development should move to .NET MAUI.
⚠️ 状态:停止服务(2024年5月)
Xamarin已正式停止支持。它曾是一个基于.NET和C#构建Android/iOS应用的跨平台框架。所有新开发工作应迁移至.NET MAUI。
When to Use
适用场景
- DO NOT USE for new projects.
- Only for maintaining legacy applications that have not yet been migrated to .NET MAUI.
- Reference for migration strategies.
- 禁止用于新项目。
- 仅用于维护尚未迁移到.NET MAUI的遗留应用。
- 作为迁移策略的参考资料。
Migration to .NET MAUI
迁移至.NET MAUI
The primary "skill" for Xamarin developers in 2025 is Migration.
对于2025年的Xamarin开发者来说,核心“技能”是迁移。
High-Level Steps:
整体步骤:
- Analyze: Use .
.NET Upgrade Assistant - Project Structure: Merge separate iOS/Android projects into the new Single Project structure (optional but recommended).
- Namespace Updates: ->
Xamarin.Forms.Microsoft.Maui.Controls - Dependencies: Replace Xamarin.Essentials with MAUI Essentials.
- Renderers: Convert Custom Renderers to Handlers (Mapped architecture).
- 分析:使用工具。
.NET Upgrade Assistant - 项目结构:将独立的iOS/Android项目合并为新的单项目结构(可选但推荐)。
- 命名空间更新:->
Xamarin.Forms。Microsoft.Maui.Controls - 依赖项:用MAUI Essentials替换Xamarin.Essentials。
- 渲染器:将自定义渲染器转换为Handlers(映射架构)。
Core Concepts (Legacy)
核心概念(遗留)
Xamarin.Forms
Xamarin.Forms
The UI abstraction layer sharing XAML code across platforms. Replaced by MAUI.
跨平台共享XAML代码的UI抽象层,已被MAUI取代。
Custom Renderers
自定义渲染器
The mechanism to customize native controls. Heavy and slow. Replaced by MAUI Handlers (interface-based).
用于自定义原生控件的机制,较为笨重且缓慢,已被基于接口的MAUI Handlers取代。
Xamarin.Native (Classic)
Xamarin.Native(经典版)
Writing UI in Storyboards (.xib) and Android XML but utilizing C# logic.
使用Storyboards(.xib)和Android XML编写UI,但采用C#逻辑。
Best Practices (Maintenance)
最佳实践(维护)
Do:
- Plan your migration immediately. Security patches are no longer guaranteed.
- Isolate platform-specific code to make migration to MAUI Handlers easier.
Don't:
- Don't start new features in Xamarin.Forms.
- Don't rely on unmaintained NuGet packages.
建议:
- 立即规划迁移:不再提供安全补丁。
- 隔离平台特定代码,以便更轻松地迁移到MAUI Handlers。
不建议:
- 不要在Xamarin.Forms中开发新功能。
- 不要依赖未维护的NuGet包。
Troubleshooting
故障排除
| Error | Cause | Solution |
|---|---|---|
| Package dropped Xamarin support. | Find MAUI equivalent or fork legacy version. |
| Toolchain conflicts (VS 2022+). | Ensure legacy workloads are installed (check Visual Studio Installer). |
| 错误信息 | 原因 | 解决方案 |
|---|---|---|
| 该包已停止支持Xamarin | 寻找MAUI等效包,或复刻遗留版本 |
| 工具链冲突(VS 2022及以上版本) | 确保已安装遗留工作负载(检查Visual Studio安装程序) |