UWP Project Structure
A default Blank App (Universal Windows) project in Visual Studio scaffolds a predictable folder structure: App.xaml/App.xaml.cs as the application entry point, MainPage.xaml/MainPage.xaml.cs as the first page shown, a Package.appxmanifest describing the app's identity and capabilities, an Assets folder holding tile and splash-screen images at multiple resolutions, and a Properties folder with default launch settings. Understanding this layout matters because Visual Studio, the Store submission pipeline, and MSBuild's UWP-specific targets all expect these files to exist at specific paths and with specific naming conventions — renaming or relocating them incorrectly breaks packaging.
Cricket analogy: Like a cricket ground having a fixed layout, the pitch in the center, the boundary rope, the pavilion, that every team relies on being in a predictable place, a UWP project's App.xaml, MainPage.xaml, and manifest sit in predictable locations that Visual Studio's build tooling expects.
Core Files: App.xaml, MainPage.xaml, and the Manifest
App.xaml.cs contains the Application-derived class and its OnLaunched override, which is the very first code that runs when the OS activates the app; it's responsible for creating the root Frame, restoring any previously saved navigation state, and calling Window.Current.Activate() to actually show the window. MainPage.xaml/MainPage.xaml.cs is the first page navigated to by default and behaves like any other UWP Page, while Package.appxmanifest — technically an XML file, though Visual Studio shows it in a friendly designer view — declares the app's identity (name, publisher, version), visual assets, capabilities, and declared extensions like background tasks or file type associations.
Cricket analogy: Like the toss deciding which captain sets the tone before a ball is even bowled, App.xaml's OnLaunched runs before any UI is visible and sets the tone for the whole session by creating the root Frame and activating the window.
Assets, Resources, and Localization
Localization in UWP follows the Windows Runtime resource system: instead of hardcoding strings in XAML or C#, you place them in Strings/en-US/Resources.resw (and Strings/fr-FR/Resources.resw for French, etc.), reference them with x:Uid in XAML or ResourceLoader.GetString in code, and Windows automatically picks the matching resource file based on the user's display language at runtime. Visual assets like the Square44x44Logo (used for the taskbar/Start tile) and Square150x150Logo (medium tile) need multiple scale variants (100%, 150%, 200%, 400%) named with a suffix like Square44x44Logo.scale-200.png so the OS can pick the crispest version for the current display's DPI without upscaling blur.
Cricket analogy: Like commentary being broadcast in Hindi for the Indian feed and English for the international feed from the same match footage, UWP's Resources.resw files let the same MainPage.xaml show localized strings automatically based on the user's display language.
protected override void OnLaunched(LaunchActivatedEventArgs e)
{
Frame rootFrame = Window.Current.Content as Frame;
if (rootFrame == null)
{
rootFrame = new Frame();
rootFrame.NavigationFailed += OnNavigationFailed;
Window.Current.Content = rootFrame;
}
if (e.PrelaunchActivated == false)
{
if (rootFrame.Content == null)
{
rootFrame.Navigate(typeof(MainPage), e.Arguments);
}
Window.Current.Activate();
}
}Build Configuration and the .pri Resource Index
During build, Visual Studio's UWP MSBuild targets compile every .resw file and referenced image asset into a single Package Resource Index (.pri) file, a binary index that lets the runtime resolve the correct localized string or scaled image quickly without scanning the file system. The .csproj also declares TargetPlatformVersion and TargetPlatformMinVersion, which set the SDK the app compiles against and the oldest Windows 10 build it can install on respectively, and references the Microsoft.NETCore.UniversalWindowsPlatform NuGet package that supplies the UWP-specific .NET reference assemblies MSBuild needs.
Cricket analogy: Like a scorer's book condensing an entire match's deliveries into a compact scorecard anyone can look up instantly, the .pri file condenses every .resw string and scaled asset into one binary index the runtime can look up instantly.
TargetPlatformMinVersion controls the oldest Windows 10 build (e.g., 10.0.17763.0, the October 2018 Update) your package will install on; calling an API newer than that minimum without an ApiInformation check will compile fine but crash at runtime on older devices.
- A default UWP project scaffolds App.xaml/.cs, MainPage.xaml/.cs, Package.appxmanifest, and an Assets folder.
- App.xaml.cs's OnLaunched creates the root Frame, restores state, and calls Window.Current.Activate() before any UI shows.
- Localized strings live in per-language Strings/xx-XX/Resources.resw files, resolved automatically via x:Uid or ResourceLoader.
- Tile and logo images need multiple DPI scale variants (scale-100/150/200/400) named by convention.
- MSBuild compiles all .resw and image resources into a single binary .pri (Package Resource Index) file.
- TargetPlatformVersion/TargetPlatformMinVersion in the .csproj set the SDK compiled against and the oldest installable Windows 10 build.
Practice what you learned
1. Which method in App.xaml.cs is the first code to run when a UWP app is activated?
2. Where do UWP apps store per-language localized strings?
3. What is a .pri file?
4. What does TargetPlatformMinVersion control in a UWP project?
Was this page helpful?
You May Also Like
What Is UWP?
An overview of the Universal Windows Platform, the WinRT API layer it runs on, and how one app package targets multiple Windows 10 device families.
The App Manifest in UWP
How Package.appxmanifest declares a UWP app's identity, visual elements, sandbox capabilities, and system integration extensions.
UWP Application Lifecycle
How UWP apps move through NotRunning, Activating, Running, Suspended, and silent termination, and how to save and restore state correctly.
Related Reading
Related Study Notes in Microsoft Technologies
Browse all study notesWindows Batch Scripting Study Notes
Batch · 30 topics
Microsoft TechnologiesMFC (Microsoft Foundation Classes) Study Notes
C++ · 30 topics
Microsoft TechnologiesSilverlight Study Notes
.NET · 30 topics
Microsoft TechnologiesXAML Study Notes
.NET · 30 topics
Microsoft TechnologiesWPF (Windows Presentation Foundation) Study Notes
.NET · 30 topics
Microsoft TechnologiesMVVM Design Pattern Study Notes
.NET · 30 topics