Token导航 LogoToken导航TokenDH.com
开发需要联网github未标认证来源可访问许可证需确认审计通过

dotnet-maui-aot毛伊岛 aot 点网

Agent Skill

dotnet-maui-aot 用于处理 GitHub 仓库、Issue、Pull Request 和代码协作信息,适合在 Codex、Claude、Cursor、Gemini CLI 中需要围绕仓库状态、代码变更或协作事项进行整理时使用。可结合来源仓库、安装命令和原始 README 继续核验具体用法。安装前建议确认权限范围、维护状态,以及是否会触发联网、命令执行或文件读写。

总安装

309

周安装

13

GitHub Stars

15

下载量

108
CodexClaudeCursorGemini CLI

安装说明

本站只整理中文说明和来源信息,不托管安装包,也不代用户安装。

GitHub

来源数

2

许可证

unknown

最后核验

2026-05-01

来源状态

来源可访问

安装方式

通过对话安装

复制提示词发给支持本地命令或 Skills 的 AI 助手,先确认命令和权限,再让它执行。

请帮我安装这个 Agent Skill:dotnet-maui-aot(毛伊岛 aot 点网)
来源仓库:https://github.com/wshaddix/dotnet-skills
仓库路径:skills/dotnet-maui-aot
安装命令:
npx skills add https://github.com/wshaddix/dotnet-skills --skill dotnet-maui-aot
安装前请先检查当前环境是否支持对应 CLI,并向我确认将要执行的命令、安装目录、联网范围和文件读写权限;确认后再执行。

命令行安装

复制命令到本机终端执行。该命令会通过 npx skills 从第三方来源获取 Skill;本站只展示命令,不托管安装包,也不自动执行。

skills.shnpx skills
npx skills add https://github.com/wshaddix/dotnet-skills --skill dotnet-maui-aot

简介

用于处理 GitHub 仓库、Issue、Pull Request 和代码协作信息。

  • 适合在需要围绕仓库状态或协作事项进行整理时使用。
  • 可结合来源仓库进一步核验具体用法。dotnet-maui-aot 属于开发类 Skill,可作为该场景下的辅助能力补充。
  • 安装前建议确认权限范围与维护状态。
  • 注意:Native AOT 目前仅支持 iOS 和 Mac Catalyst。

SKILL.md

dotnet-maui-aot

Native AOT compilation for.NET MAUI on iOS and Mac Catalyst: compilation pipeline, publish profiles, up to 50% app size reduction and up to 50% startup improvement, library compatibility gaps, opt-out mechanisms, trimming interplay (RD.xml, source generators), and testing AOT builds on device.

Version assumptions:.NET 8.0+ baseline. Native AOT for MAUI is available on iOS and Mac Catalyst. Android uses a different compilation model (CoreCLR in.NET 11, Mono/AOT in.NET 8-10).

Scope boundary: This skill owns MAUI-specific Native AOT on iOS/Mac Catalyst -- the compilation pipeline, publish configuration, size/startup improvements, library compatibility for MAUI apps, and testing AOT builds. General Native AOT patterns are owned by [skill:dotnet-native-aot]; AOT architecture decisions by [skill:dotnet-aot-architecture].

Out of scope: MAUI development patterns (project structure, XAML, MVVM) -- see [skill:dotnet-maui-development]. MAUI testing -- see [skill:dotnet-maui-testing]. WASM AOT (Blazor/Uno) -- see [skill:dotnet-aot-wasm]. General AOT architecture -- see [skill:dotnet-native-aot].

Cross-references: [skill:dotnet-maui-development] for MAUI patterns, [skill:dotnet-maui-testing] for testing AOT builds, [skill:dotnet-native-aot] for general AOT patterns, [skill:dotnet-aot-wasm] for WASM AOT, [skill:dotnet-ui-chooser] for framework selection.


iOS/Mac Catalyst AOT Compilation Pipeline

Native AOT on iOS and Mac Catalyst compiles.NET IL directly to native machine code at publish time, eliminating the need for a JIT compiler or IL interpreter at runtime. This produces a self-contained native binary that links against platform frameworks.

How It Works

  1. IL compilation: The.NET IL is compiled to native code by the NativeAOT compiler (ILC)
  2. Tree shaking: Unused code is trimmed based on static analysis of reachable types and methods
  3. Native linking: The generated native code is linked with iOS/Catalyst frameworks and the minimal.NET runtime
  4. App bundle: The result is a standard .app bundle with a native executable (no IL assemblies shipped)

Publish Configuration

<!-- Enable Native AOT for iOS/Mac Catalyst -->
<PropertyGroup Condition="'$(TargetFramework)' == 'net8.0-ios' Or
                          '$(TargetFramework)' == 'net8.0-maccatalyst'">
  <PublishAot>true</PublishAot>
  <!-- Optional: strip debug symbols for smaller binary -->
  <StripSymbols>true</StripSymbols>
</PropertyGroup>
# Publish with AOT for iOS
dotnet publish -f net8.0-ios -c Release -r ios-arm64

# Publish with AOT for Mac Catalyst
dotnet publish -f net8.0-maccatalyst -c Release -r maccatalyst-arm64

# Publish for iOS simulator (for AOT testing without device)
dotnet publish -f net8.0-ios -c Release -r iossimulator-arm64

Entitlements and Provisioning

AOT builds require the same entitlements and provisioning profiles as regular iOS/Catalyst builds. No additional entitlements are needed for AOT specifically.

<!-- iOS entitlements (Entitlements.plist) -->
<!-- Standard entitlements; AOT does not require special entries -->

Size Reduction

Native AOT can achieve up to 50% app size reduction compared to interpreter/JIT mode on iOS. The size improvement comes from:

  • Tree shaking: Only reachable code is included in the final binary
  • No IL shipping: The app bundle does not include.NET IL assemblies
  • No runtime JIT: The JIT compiler and associated metadata are not packaged

Typical Size Comparison

ModeApproximate SizeNotes
Interpreter (default.NET 8 iOS)~60-80 MBIncludes IL assemblies + interpreter
Native AOT~30-45 MBNative binary only, no IL
Native AOT + StripSymbols~25-40 MBDebug symbols stripped

Caveat: Actual size reduction depends on app complexity, third-party library usage, and how much code is reachable after trimming. Libraries that use heavy reflection may prevent aggressive trimming and reduce size gains.


Startup Improvement

Native AOT provides up to 50% faster cold startup on iOS and Mac Catalyst. The startup improvement comes from:

  • No JIT warmup: Code is already native; no compilation at app launch
  • No IL loading: No need to load and parse.NET assemblies
  • Reduced memory pressure: Smaller working set during startup

Measuring Startup

// Instrument startup timing
public partial class App : Application
{
    private static readonly long StartTicks = Stopwatch.GetTimestamp();

    public App()
    {
        InitializeComponent();
        MainPage = new AppShell();

        var elapsed = Stopwatch.GetElapsedTime(StartTicks);
        System.Diagnostics.Debug.WriteLine(
            $"App startup: {elapsed.TotalMilliseconds:F0}ms");
    }
}
# Use Xcode Instruments for precise startup measurement
# Time Profiler template → measure "pre-main" + "post-main" time
# Compare AOT vs non-AOT builds on the same device

Library Compatibility

Many.NET libraries are not fully AOT-compatible. Common compatibility issues stem from:

  • Reflection: Runtime type inspection, Type.GetType(), Activator.CreateInstance()
  • Dynamic code generation: System.Reflection.Emit, System.Linq.Expressions.Compile()
  • Serialization without source generators: JSON/XML serializers that use reflection

Compatibility Matrix

Library / FeatureAOT StatusWorkaround
System.Text.Json (source gen)CompatibleUse [JsonSerializable] context
System.Text.Json (reflection)BreaksSwitch to source generators
CommunityToolkit.MvvmCompatibleSource-gen based, AOT-safe
Entity Framework CorePartialPrecompiled queries; no dynamic LINQ
Newtonsoft.JsonBreaksMigrate to System.Text.Json with source gen
AutoMapperBreaksUse Mapperly (source gen)
MediatRPartialRegister handlers explicitly, avoid assembly scanning
HttpClientCompatibleStandard usage works
MAUI EssentialsCompatiblePlatform APIs are AOT-safe
SQLite-netCompatibleUses P/Invoke, AOT-safe
RefitBreaksUse Refit 7+ (includes source generator; enable with [GenerateRefitClient])
FluentValidationPartialAvoid runtime expression compilation

Detecting Incompatible Code

<!-- Enable AOT analysis warnings during development -->
<PropertyGroup>
  <EnableAotAnalyzer>true</EnableAotAnalyzer>
  <!-- Also enable trim analyzer (AOT requires trimming) -->
  <EnableTrimAnalyzer>true</EnableTrimAnalyzer>
</PropertyGroup>

AOT analysis produces warnings like IL3050 (RequiresDynamicCode) and IL2026 (RequiresUnreferencedCode). Address these before publishing with AOT.


Opt-Out Mechanisms

Disabling AOT Entirely

<!-- Disable Native AOT (use interpreter/JIT mode) -->
<PropertyGroup>
  <PublishAot>false</PublishAot>
</PropertyGroup>

Per-Assembly Trimming Overrides

When a specific library is not AOT-compatible, you can preserve it from trimming while still using AOT for the rest of the app:

<!-- Preserve a specific assembly from trimming -->
<ItemGroup>
  <TrimmerRootAssembly Include="IncompatibleLibrary" />
</ItemGroup>

Opt-Out of.NET 11 Defaults

.NET 11 introduces new defaults that interact with AOT:

<!-- Revert XAML source gen (use legacy XAMLC) -->
<PropertyGroup>
  <MauiXamlInflator>XamlC</MauiXamlInflator>
</PropertyGroup>

<!-- Revert to Mono runtime on Android (not related to iOS AOT,
     but relevant for the overall MAUI AOT story) -->
<PropertyGroup>
  <UseMonoRuntime>true</UseMonoRuntime>
</PropertyGroup>

Trimming Interplay

Native AOT requires trimming. When PublishAot is true, trimming is automatically enabled. Understanding trimming configuration is essential for a successful AOT build.

ILLink Descriptors for Reflection Preservation

Note: In Xamarin/Mono-era documentation, these were called "rd.xml" (Runtime Directives). In.NET 8+ Native AOT, use ILLink descriptor XML files instead.

When code uses reflection that the trimmer cannot statically analyze, use an ILLink descriptor XML file to preserve types. You can also use [DynamicDependency] attributes for fine-grained preservation in code.

ILLink descriptor XML (preferred for bulk preservation):

<!-- ILLink.Descriptors.xml -- preserve types needed at runtime -->
<linker>
  <!-- Preserve all public members of a type -->
  <assembly fullname="MyApp">
    <type fullname="MyApp.Models.LegacyConfig" preserve="all" />
    <type fullname="MyApp.Services.PluginLoader">
      <method name="LoadPlugin" />
    </type>
  </assembly>

  <!-- Preserve all types in an external assembly -->
  <assembly fullname="IncompatibleLibrary" preserve="all" />
</linker>
<!-- Register the descriptor in .csproj -->
<ItemGroup>
  <TrimmerRootDescriptor Include="ILLink.Descriptors.xml" />
</ItemGroup>

[DynamicDependency] attribute (preferred for targeted preservation):

using System.Diagnostics.CodeAnalysis;

// Preserve a specific method on a type
[DynamicDependency(nameof(LegacyConfig.Initialize), typeof(LegacyConfig))]
public void ConfigureApp() { /* ... */ }

// Preserve all public members of a type
[DynamicDependency(DynamicallyAccessedMemberTypes.All, typeof(LegacyConfig))]
public void LoadPlugins() { /* ... */ }

Source Generator Alternatives

When source generators aren't available, use [DynamicDependency] attributes (shown above) for targeted preservation without ILLink XML files.

Prefer source generators over reflection to avoid trimming issues entirely:

Reflection PatternSource Generator Alternative
JsonSerializer.Deserialize<T>()[JsonSerializable] context (System.Text.Json)
Activator.CreateInstance<T>()Factory pattern with explicit registration
Type.GetProperties()CommunityToolkit.Mvvm [ObservableProperty]
Assembly scanning for DIExplicit services.Add*() registrations
AutoMapper reflection mappingMapperly [Mapper] source generator

Trimming Warnings

# Build with detailed trim warnings
dotnet publish -f net8.0-ios -c Release /p:PublishAot=true /p:TrimmerSingleWarn=false

# TrimmerSingleWarn=false shows per-occurrence warnings instead of
# one summary warning per assembly, making it easier to fix issues

Common trim warnings:

  • IL2026: Member with RequiresUnreferencedCode -- the member does something not guaranteed to work after trimming
  • IL2046: Trim attribute mismatch between base/derived types
  • IL3050: Member with RequiresDynamicCode -- the member generates code at runtime (incompatible with AOT)

Testing AOT Builds

AOT builds can behave differently from Debug/JIT builds. Always test on a real device or simulator with an AOT-published build before release.

Common AOT-Only Failures

FailureSymptomFix
Missing type metadataMissingMetadataException at runtimeAdd type to ILLink descriptor or use [DynamicDependency]
Trimmed methodMissingMethodExceptionAdd [DynamicDependency] or ILLink descriptor entry
Dynamic code genPlatformNotSupportedExceptionReplace with source generator alternative
Reflection-based serializationEmpty/null deserialized objectsUse [JsonSerializable] source gen
Assembly scanningMissing services at runtimeRegister services explicitly in DI

Testing Workflow

# 1. Build and publish with AOT for simulator (faster iteration)
dotnet publish -f net8.0-ios -c Release -r iossimulator-arm64

# 2. Install and test on simulator
# (Use Xcode or Visual Studio to deploy the .app to simulator)

# 3. Run smoke tests -- focus on:
#    - App startup (no MissingMetadataException)
#    - JSON deserialization (all properties populated)
#    - Navigation (all pages render)
#    - Platform services (biometric, camera, location)
#    - Third-party SDK integration

# 4. Test on physical device before release
dotnet publish -f net8.0-ios -c Release -r ios-arm64
# Deploy via Xcode with provisioning profile

CI Integration

# CI pipeline: build AOT and run device tests via XHarness
dotnet publish -f net8.0-ios -c Release -r iossimulator-arm64 /p:PublishAot=true

xharness apple test \
    --app bin/Release/net8.0-ios/iossimulator-arm64/publish/MyApp.app \
    --target ios-simulator-64 \
    --timeout 00:10:00 \
    --output-directory test-results/aot

For MAUI testing patterns (Appium, XHarness), see [skill:dotnet-maui-testing].


Agent Gotchas

  1. Do not enable PublishAot without also enabling trim analyzers. AOT requires trimming. Set <EnableTrimAnalyzer>true</EnableTrimAnalyzer> and <EnableAotAnalyzer>true</EnableAotAnalyzer> during development to catch issues early.
  2. Do not assume all NuGet packages are AOT-compatible. Check for IsAotCompatible in the package's .csproj or look for trim/AOT warnings when building. Many popular packages still use reflection internally.
  3. Do not use Newtonsoft.Json with AOT. It relies entirely on reflection. Migrate to System.Text.Json with [JsonSerializable] source gen contexts for AOT-safe serialization.
  4. Do not skip device testing for AOT builds. Simulator testing catches most issues, but physical device behavior can differ -- especially for startup timing, memory constraints, and platform service integration.
  5. Do not confuse MAUI iOS AOT with Android AOT. MAUI Native AOT (PublishAot) targets iOS and Mac Catalyst only. Android uses a different compilation model (Mono AOT in.NET 8-10, CoreCLR in.NET 11+). They are configured separately.

Prerequisites

  • .NET 8.0+ with MAUI workload
  • Xcode and iOS/Mac Catalyst SDKs (macOS only)
  • Apple Developer account for physical device deployment
  • Provisioning profile and signing certificate for device testing

References

适合场景

01

用户想查找某类 Agent Skill 时

02

需要根据任务场景推荐可安装能力包时

03

需要对比不同来源的安装命令和来源信息时

能力概览

能力 1

按任务关键词查找相关 Skills

能力 2

展示可复制的安装命令

能力 3

保留来源站点、仓库和原始说明,方便继续核验

能力 4

展示第三方安全扫描或审计结果

安装后应在对应宿主中按原始 README 的触发条件使用;具体调用方式请以来源页面和 README 为准。

平台分布

Codex

39.67%
按下载量换算43

Claude

30.59%
按下载量换算33

Cursor

17.3%
按下载量换算19

Gemini CLI

8.65%
按下载量换算9

安全审计

Gen Agent Trust Hub

通过

Socket

通过

Snyk

通过

权限和风险

需要联网

该 Skill 可能需要联网访问来源站点、仓库或外部 API;具体网络访问范围需要结合源码和 README 复核。

安装前确认

本站仅展示第三方公开信息,不托管安装包,不提供自动安装或运行环境。安装前应自行审查源码、依赖和命令行为。当前只有一个来源,正式发布前建议补源仓库或其他目录站核验。

来源信息

继续浏览同类 Skills