制定 Xamarin 迁移至 MAUI 方案
盘点 Xamarin 项目依赖与存储,规划迁移到 MAUI 的代码改造、数据延续和验证步骤。
完整提示词
<context>
Xamarin support ended in May 2024, so a store update now needs a MAUI or .NET for iOS and Android build. Most XAML and view models carry over, but the edges do not. MAUI uses one project with platform folders instead of one head project per platform. Custom renderers still run through a compatibility layer, but the supported path is handlers with property mappers, and effects should become handler customizations. Xamarin.Essentials is folded into MAUI namespaces; Xamarin.CommunityToolkit becomes CommunityToolkit.Maui; many third-party plugins were never ported and need replacements. Layout defaults differ (spacing, `StackLayout` versus `VerticalStackLayout`, `RelativeLayout` only in compatibility), so screens that compile can look wrong. `MessagingCenter` is deprecated in favour of a messenger, and `DependencyService` should become dependency injection in `MauiProgram`. The silent risk is existing users: the bundle id, signing and version code must continue the store listing, and data saved through Xamarin.Essentials secure storage or preferences may not be readable under the same keys, so an update can log everyone out unless it is migrated.
</context>
<task>
App: {{app}}
1. Read the solution and build the inventory: renderers, effects, platform-specific code, plugins, `DependencyService` and `MessagingCenter` uses, and local storage (preferences, secure storage, SQLite paths).
2. For each plugin, find a maintained MAUI-compatible package or a built-in API; list anything without one as a blocker before porting.
3. Create the MAUI project with the same application id, display name, version scheme and signing setup. Move shared code, resources, fonts and images into the single-project structure.
4. Port renderers and effects to handlers or mapper customizations, starting with the ones used on the most screens. Replace `DependencyService` with registrations in `MauiProgram` and `MessagingCenter` with a messenger.
5. Add a one-time migration for secure storage and preferences keys if the storage format or location differs, and confirm the SQLite file path is unchanged.
6. Build and run on each platform. Compare key screens with the Xamarin version for layout differences, then test an in-place upgrade over an installed Xamarin build to confirm users stay signed in and keep their data.
</task>
<constraints>
- Do not rely on the compatibility renderer layer as the end state without saying so as a known debt.
- Do not change the application id, signing identity or version sequence; an accidental change creates a new app in the store.
- Do not claim a plugin has a MAUI version without checking; mark it "to verify".
{{> guardrails/verify-before-done}}
{{> guardrails/scope-discipline}}
</constraints>
<output_format>
## Inventory
Table: area (renderer, effect, plugin, platform code, storage) | Xamarin item | MAUI replacement | effort.
## Project structure
The new single-project layout, target frameworks and identity settings.
## Changes made
Grouped by area, with files touched.
## Data continuity
How preferences, secure storage and databases carry over for existing users.
## Verification
Per-platform checks on real devices or simulators with results.
## Remaining risks
Bullets, or "None".
</output_format>可替换内容
- {{app}}
- {{> guardrails/verify-before-done}}
- {{> guardrails/scope-discipline}}
分类与标签
编程开发、.NET MAUI、应用迁移、移动开发、数据兼容