Skip to content

MAUI failed to compile with AOT #81913

@succeed318

Description

@succeed318

11

<Project Sdk="Microsoft.NET.Sdk">

	<PropertyGroup>
		<TargetFrameworks>net6.0-android</TargetFrameworks>
		<OutputType>Exe</OutputType>
		<RootNamespace>IotTencent</RootNamespace>
		<UseMaui>true</UseMaui>
		<SingleProject>true</SingleProject>
		<ImplicitUsings>enable</ImplicitUsings>

		<!-- Display name -->
		<ApplicationTitle>XXXXXX</ApplicationTitle>

		<!-- App Identifier -->
		<ApplicationId>com.companyname.iottencent</ApplicationId>
		<ApplicationIdGuid>2695fcd7-bfcb-4b7b-8eb2-f754a9e0b289</ApplicationIdGuid>

		<!-- Versions -->
		<ApplicationDisplayVersion>1.0</ApplicationDisplayVersion>
		<ApplicationVersion>1</ApplicationVersion>
		<SupportedOSPlatformVersion Condition="$([MSBuild]::GetTargetPlatformIdentifier('$(TargetFramework)')) == 'android'">21.0</SupportedOSPlatformVersion>
	</PropertyGroup>

	<PropertyGroup Condition="'$(Configuration)|$(TargetFramework)|$(Platform)'=='Release|net6.0-android|AnyCPU'">
		<ApplicationTitle>XXX</ApplicationTitle>
		<AndroidPackageFormat>apk</AndroidPackageFormat>
               <EnableLLVM>False</EnableLLVM>

		<RunAOTCompilation>True</RunAOTCompilation>
		<PublishTrimmed>True</PublishTrimmed>

	</PropertyGroup>

	<PropertyGroup Condition="'$(Configuration)|$(TargetFramework)|$(Platform)'=='Debug|net6.0-android|AnyCPU'">
	  <EnableLLVM>False</EnableLLVM>
	</PropertyGroup>
	<ItemGroup>
		<!-- App Icon -->
		<MauiSplashScreen Include="Resources\Splash\splash.png" />

		<!-- Splash Screen -->

		<!-- Images -->
		<MauiImage Include="Resources\Images\*" />
		<MauiImage Update="Resources\Images\dotnet_bot.svg" BaseSize="168,208" />

		<!-- Custom Fonts -->
		<MauiFont Include="Resources\Fonts\*" />

		<!-- Raw Assets (also remove the "Resources\Raw" prefix) -->
		<MauiAsset Include="Resources\Raw\**" LogicalName="%(RecursiveDir)%(Filename)%(Extension)" />
	</ItemGroup>

	<ItemGroup>
		<None Remove="Resources\AppIcon\appicon.png" />
		<None Remove="Resources\Fonts\iconfont.ttf" />
		<None Remove="Resources\Splash\splash.png" />
	</ItemGroup>

	<ItemGroup>
		<MauiIcon Include="Resources\AppIcon\appicon.png" BaseSize="128,128" />
	</ItemGroup>

	<ItemGroup>
		<PackageReference Include="CommunityToolkit.Mvvm" Version="8.0.0" />
		<PackageReference Include="TencentCloudSDK" Version="3.0.679" />
	</ItemGroup>

	<ItemGroup>
		<None Update="Resources\AppIcon\appicon.svg" ForegroundFile="Resources\AppIcon\appiconfg.svg" Color="#512BD4" />
		<None Update="Resources\Splash\splash11.svg" Color="#512BD4" BaseSize="128,128" />
	</ItemGroup>

	<ItemGroup>
		<MauiXaml Update="Views\Home.xaml">
			<Generator>MSBuild:Compile</Generator>
		</MauiXaml>
		<MauiXaml Update="Views\Start.xaml">
			<Generator>MSBuild:Compile</Generator>
		</MauiXaml>
	</ItemGroup>

</Project>

use follow config:

<RunAOTCompilation>True</RunAOTCompilation>
<PublishTrimmed>True</PublishTrimmed>

<ItemGroup>
		<PackageReference Include="CommunityToolkit.Mvvm" Version="8.0.0" />
		<PackageReference Include="TencentCloudSDK" Version="3.0.679" />
</ItemGroup>
  1. Create a MAUI APP project with VS2022(Version 17.4.4)
  2. install TencentCloud.dll from nuget;
  3. direct publish project,
    it takes very long,long time; about three hours. finally compiler fail.

Metadata

Metadata

Assignees

Type

No type

Projects

No projects

Milestone

No milestone

Relationships

None yet

Development

No branches or pull requests

Issue actions