Project Folder Structure of MAUI (Preview 6)

Introduction

For any project, the folder structure is very important. We can organize the files and also if required, we can amend our changes easily. In this article, we will see the default Folder Structure of MAUI Preview 6. If you are new to this article, I would like to strongly recommend you to have a look at the previous article here.

Folder Structure

Fig.1 MAUI Folder Structure
.csproj

First lets look into this project file, where we can see some important details such as Target frameworks and does the project needs to use MAUI workload or not.

Fig.2 .csproj

Since MAUI is single project which is going to be deployed in multiple platforms, those platforms frameworks are mentioned in the tag <TargetFrameworks>

Sample
<TargetFrameworks>net6.0-ios;net6.0-android;net6.0-maccatalyst</TargetFrameworks>

To use the MAUI workload, <UseMaui> tag value needs to set as true.

Sample
<UseMaui>true</UseMaui>
Platforms

As we know, MAUI is a cross platform framework to build Mobile, Desktop applications from the single code base. Those multiple platforms are listed under the Platforms Folder.

Fig.3 Mobile Platform Files
Startup.cs

The point of entry for our application is Startup.cs.

  • It includes a Configure method to pipe service registration, handler registration.
public class Startup : IStartup
	{
		public void Configure(IAppHostBuilder appBuilder)
		{
			appBuilder
				.UseMauiApp<App>()
				.ConfigureFonts(fonts =>
				{
					fonts.AddFont("OpenSans-Regular.ttf", "OpenSansRegular");
				});
		}
	}
App.xaml

App.xaml and App.xaml.cs file is inherited by Microsoft.Maui.Controls.Application. The App.xaml will work same like Xamarin form and will add the all the common resources and style

Fig.4 App.xaml
Fig. 5 App.xaml.cs
Resources

This folder holds the default fonts, Images and Icons which are used in the project.

Fig. 6 Resources Folder
MainPage.xaml

This file holds the UI designs of our MAUI application.  This file is mostly used to define the visual contents of a page and works together with a C# code-behind file

Fig. 7 MainPage.xaml

Conclusion

In this article we have discussed in a high level of Folder structure. I hope you all found this article useful. Please share your feedback in the comment section. We will explore on MAUI Applications in our upcoming articles.

Consider to Read

One thought on “Project Folder Structure of MAUI (Preview 6)

Add yours

Leave a Reply

Fill in your details below or click an icon to log in:

WordPress.com Logo

You are commenting using your WordPress.com account. Log Out /  Change )

Google photo

You are commenting using your Google account. Log Out /  Change )

Twitter picture

You are commenting using your Twitter account. Log Out /  Change )

Facebook photo

You are commenting using your Facebook account. Log Out /  Change )

Connecting to %s

Website Built with WordPress.com.

Up ↑

%d bloggers like this: