Skip to content

Unable to compile Maui app when TargetFrameworks include other than Android and iOS

Elvin (Tharindu) Thudugala edited this page Jan 14, 2023 · 1 revision

Two Options to resolve this

Remove all the other TargetFrameworks other than Android and iOS

or

Add preprocessor directives ANDROID || IOS for UseLocalNotification

public static class MauiProgram
{
	public static MauiApp CreateMauiApp()
	{
		var builder = MauiApp.CreateBuilder();
		builder
			.UseMauiApp<App>()
#if ANDROID || IOS
            .UseLocalNotification()
#endif
            .ConfigureFonts(fonts =>
			....
		return builder. Build();
	}
}