uid |
---|
Uno.Development.AppStructure |
This guide briefly explains the structure of an app created with the default Uno Platform app template. It's particularly aimed at developers who have not worked with cross-platform codebases before.
After creating a new solution with the Uno Platform App Template called HelloWorld
, it will contain the following projects:
-
A
HelloWorld.[Platform].csproj
file for each platform that Uno Platform supports: Windows, Mobile (iOS/Android/Catalyst), Skia.Gtk, Skia.Wpf, Skia.Framebuffer, Server, and WebAssembly. These projects are known as heads for their respective platform. Those contain typical information like settings, metadata, dependencies, and also a list of files included in the project. The platform head builds and packages executable binaries for that platform. Each of these projects takes a reference from the project below. -
A
HelloWorld.csproj
file. This Class Library Project generally contains most of the code for the application, such as the XAML files or business logic. Bootstrapping code, packaging settings, and platform-specific code goes in the corresponding platform head. String resources normally go in the app's Class Library Project project. Image assets may go either in the app's Class Library Project or under each project head. Font assets can also be placed in this project.
Note
The App.xaml
and App.xaml.cs
in an Uno Platform solution template are named AppResources.xaml
and App.cs
, respectively. Both are automatically included as part of each head's App.xaml
and App.xaml.cs
in order to create a cross-platform experience. It is recommended to use AppResources.xaml
and App.cs
for editing the application's startup.
Dependencies in Uno solutions can be added preferably in the app's Class Library Project, but can also be added per platform at the project heads level.
See additional guides on handling platform-specific C# code and XAML markup in an Uno Platform project.
The Uno Platform solution also can be further optimized to build larger projects with Visual Studio 2022.