Skip to content

[NativeAOT] Simplify build integration with external bundlers for Apple platforms #87187

Open
@ivanpovazan

Description

@ivanpovazan

Description

In order to support targeting Apple platforms NativeAOT build targets need to be integrated with external build systems and bundlers like:

To achieve this, several project properties need to be set in the correct way and we are currently collecting all that is necessary to achieve the integration.

  • For example: in case of targeting an iOS application with NativeAOT (PublishAot=true) and integrating it with an external build pipeline, these are the properties that need to be set:

    <PropertyGroup>
        <!-- This works around an issue in NativeAOT: https://github.com/dotnet/runtime/issues/86186 -->
        <IlcKeepManagedDebuggerSupport>true</IlcKeepManagedDebuggerSupport>
        <!-- We must find the BCL libraries using the runtime pack instead of using the built-in NativeAOT BCL: https://github.com/dotnet/runtime/issues/87060 -->
        <PublishAotUsingRuntimePack>true</PublishAotUsingRuntimePack>
        <!-- Build as a static lib -->
        <NativeLib>static</NativeLib> 
        <!-- Split init for the custom native host -->
        <CustomNativeMain>true</CustomNativeMain>
        <!-- Escape NativeAOT bundling targets -->
        <NativeCompilationDuringPublish>false</NativeCompilationDuringPublish>
        <IlcCompileDependsOn>Compile;ComputeIlcCompileInputs;SetupOSSpecificProps;PrepareForILLink</IlcCompileDependsOn>
    </PropertyGroup>
    <ItemGroup>
        <DirectPInvoke Include="__Internal" />
    </ItemGroup>

NOTE: Please note that the list above is not complete, it merely lists the current workarounds to enable building an iOS application.

To improve the integration process and maintainability it would be beneficial to simplify the integration process when targeting Apple platforms with a single "opt-in" MSBuild property.

Metadata

Metadata

Assignees

Type

No type

Projects

Status

No status

Relationships

None yet

Development

No branches or pull requests

Issue actions