Advertisement

Project Structure & App Startup interview questions and answers

5 Project Structure & App Startup interview questions for .NET MAUI roles, each with a model answer, examples and likely follow-ups.

5 questions
Advertisement

5 questions

Q1 Beginner Save

What is the purpose of the Platforms folder?

The Platforms folder holds platform-specific entry points and code: Android (MainActivity, MainApplication), iOS/MacCatalyst (AppDelegate, Program), and Windows (App.xaml). MAUI compiles only the relevant Platforms subfolder for each target framework, so you can write native code guarded by that platform without #if in most cases.
Real-world example
A developer requests a runtime permission by editing only Platforms/Android/MainActivity.cs, leaving shared code untouched.
Likely follow-ups
  • What is MainActivity? | How does per-platform compilation work?
Single Project Platform Integration Multi-targeting
Q2 Beginner Save

Where do you place images, fonts, and app icons in MAUI?

Shared assets live in the Resources folder: Resources/Images, Resources/Fonts, Resources/AppIcon, and Resources/Splash. They are declared in the .csproj as MauiImage, MauiFont, MauiIcon, or MauiSplashScreen build actions, and MAUI generates correctly sized platform assets at build time from a single source (SVGs are resized without quality loss).
<ItemGroup>
    <MauiIcon Include="Resources\AppIcon\appicon.svg" />
    <MauiSplashScreen Include="Resources\Splash\splash.svg" Color="#512BD4" />
    <MauiImage Include="Resources\Images\*" />
    <MauiFont Include="Resources\Fonts\*" />
</ItemGroup>
Real-world example
A designer supplies one appicon.svg and MAUI emits every density-specific icon Android and iOS require automatically.
Likely follow-ups
  • How are SVGs resized? | How do you reference a font in XAML?
Resources App Icons Fonts
Q3 Intermediate Save

How does multi-targeting work in the MAUI .csproj?

The <TargetFrameworks> property lists monikers like net8.0-android and net8.0-ios. MSBuild builds the project once per moniker. You can use MSBuild conditions and the Platforms folder filename convention (e.g., MyService.Android.cs) so files compile only for matching targets, avoiding scattered preprocessor directives.
<TargetFrameworks>net8.0-android;net8.0-ios</TargetFrameworks>
<PropertyGroup Condition="'$(TargetFramework)'=='net8.0-android'">
    <DefineConstants>$(DefineConstants);MY_ANDROID</DefineConstants>
</PropertyGroup>
Real-world example
A CI pipeline builds only the Android target on a Linux agent and the iOS target on a Mac agent from the same csproj.
Likely follow-ups
  • What are partial classes used for here? | How do filename conventions target platforms?
Multi-targeting Conditional Compilation Platform Integration
Q4 Intermediate Save

How do the native entry points bootstrap a MAUI app on Android and iOS?

On Android, MainApplication overrides CreateMauiApp() to return MauiProgram.CreateMauiApp(), and MainActivity (a MauiAppCompatActivity) hosts it. On iOS/Mac Catalyst, AppDelegate (a MauiUIApplicationDelegate) does the same. These bridge the native app lifecycle to the shared MAUI host.
// Platforms/Android/MainApplication.cs
public class MainApplication : MauiApplication
{
    public MainApplication(IntPtr handle, JniHandleOwnership ownership)
        : base(handle, ownership) { }

    protected override MauiApp CreateMauiApp() => MauiProgram.CreateMauiApp();
}
Real-world example
When adding a third-party SDK that needs Application.OnCreate, the developer hooks it in MainApplication before the base call.
Likely follow-ups
  • What class does MainActivity inherit? | Where is CreateMauiApp defined?
App Lifecycle MauiProgram Platform Integration
Q5 Advanced Save

How do you register and consume platform-specific implementations of a shared interface?

Define the interface in shared code, implement it per platform using partial classes or the Platforms folder, and register it in DI. A common pattern is a partial class with a shared signature and platform-specific bodies compiled per target, or conditional registration in MauiProgram.
// Shared
public interface IDeviceInfoService { string GetId(); }

// Platforms/Android/DeviceInfoService.cs
partial class DeviceInfoService : IDeviceInfoService
{
    public string GetId() => Android.OS.Build.Serial ?? "unknown";
}

// MauiProgram.cs
builder.Services.AddSingleton<IDeviceInfoService, DeviceInfoService>();
Real-world example
A team reads a hardware identifier differently on each OS but injects a single IDeviceInfoService everywhere in shared code.
Likely follow-ups
  • How do partial classes multi-target? | Could you use conditional DI registration instead?
Dependency Injection Multi-targeting Platform Integration