Share via

What are the Files in a .NET MAUI Template? (Confusion)

Shreyans Yadav 40 Reputation points
2026-02-13T14:11:32.97+00:00

Dear Community Members,

I am Shreyans Yadav,

I’m new to .NET MAUI and I created a new project using the default MAUI template.

I see a lot of files and folders like App.xaml, MainPage.xaml, Platforms, Resources, MauiProgram.cs, and more. I’m confused about what each file does and which ones I should modify when building my app. Can someone explain the purpose of the main files in a .NET MAUI project and give a brief idea of what they are used for?

Windows development | WinUI
0 comments No comments
{count} votes

Answer accepted by question author
  1. Marcin Policht 81,630 Reputation points MVP Volunteer Moderator
    2026-02-13T14:15:49.71+00:00

    A default .NET MAUI project is structured to separate app startup, UI, platform-specific code, and shared resources so you can build one app that runs on multiple platforms. You generally spend most of your time in XAML pages, view models, services, and the dependency registration area in MauiProgram.cs. Many of the other folders exist mainly to organize assets or hold platform-specific configurations that you only touch when you need customization.

    App.xaml defines global application resources and the application lifecycle entry point. It usually contains merged resource dictionaries, styles, colors, and themes that apply across the entire app. Its code-behind file App.xaml.cs sets the main page or shell when the app starts. You typically modify this when you add global styles or need to control how the app launches. For example, you might see something like:

    public partial class App : Application
    {
        public App()
        {
            InitializeComponent();
            MainPage = new AppShell();
        }
    }
    

    MainPage.xaml is simply the default starting UI page created by the template. It represents a visual screen and is paired with MainPage.xaml.cs, which contains event handlers or page logic. As your app grows you will create additional pages similar to this and may eventually delete or replace MainPage entirely. The XAML file describes layout and UI components while the code-behind handles behavior.

    AppShell.xaml defines the navigation structure when you use Shell, which is the default MAUI navigation system. It manages routes, tabs, flyout menus, and page hierarchy. You typically update this file when adding new pages or navigation flows because it controls how users move around the app. For example, adding a new page route might look like:

    <ShellContent Title="Home" ContentTemplate="{DataTemplate local:MainPage}" />
    

    MauiProgram.cs is the application startup configuration file. It builds the MAUI app, registers fonts, configures services for dependency injection, and sets up libraries. This is one of the most frequently modified files as your project grows because you register services, HTTP clients, logging, or platform features here. A common example is:

    builder.Services.AddSingleton<IMyService, MyService>();
    

    The Platforms folder contains platform-specific entry points and configuration files for Android, iOS, Windows, and macOS. These files handle things like AndroidManifest.xml, Info.plist, and native startup logic. Most of the time you leave them alone unless you need platform permissions, native APIs, or custom platform behavior. Think of this folder as the bridge between your shared MAUI code and each operating system.

    The Resources folder stores shared assets such as images, fonts, app icons, splash screens, raw files, styles, and colors. MAUI uses a single-project system that automatically processes these resources for each platform, so you typically add or modify files here when you need branding assets or design resources. Colors.xaml and Styles.xaml inside this area often define reusable UI themes that are referenced across pages.


    If the above response helps answer your question, remember to "Accept Answer" so that others in the community facing similar issues can easily find the solution. Your contribution is highly appreciated.

    hth

    Marcin

    1 person found this answer helpful.

0 additional answers

Sort by: Most helpful

Your answer

Answers can be marked as 'Accepted' by the question author and 'Recommended' by moderators, which helps users know the answer solved the author's problem.