Uno Platform Migration and Troubleshooting
Patterns for migrating to modern Uno Platform project structures, upgrading .NET versions, and resolving the most common build and runtime errors.
Migration to Single Project (Uno.Sdk 5.2+)
Overview
Single Project consolidates multiple platform-specific .csproj files into one project using Uno.Sdk. Migration is optional; existing multi-project structures remain supported.
Step-by-Step
-
Create a reference project with the same name using
dotnet new unoapp:dotnet new unoapp -o MyApp --preset=recommended -
Add
global.jsonnext to the solution:{ "msbuild-sdks": { "Uno.Sdk": "{current Uno.Sdk version}" } } -
Copy the new
.csprojstructure from the reference project -
Merge platform folders into
Platforms/:MyApp.Wasm/content toPlatforms/WebAssembly/MyApp.Mobile/Android/,MyApp.Mobile/iOS/toPlatforms/MyApp.Skia.*content toPlatforms/Desktop/
-
Copy
App.xamlandApp.xaml.csfrom reference, then merge your custom changes (OnLaunched, RegisterRoutes, InitializeLogging) -
Use conditional TFM blocks for platform-specific config:
<Choose> <When Condition="'$(TargetFramework)'=='net9.0-browserwasm'"> <PropertyGroup> <WasmShellMonoRuntimeExecutionMode>InterpreterAndAOT</WasmShellMonoRuntimeExecutionMode> </PropertyGroup> </When> </Choose> -
Replace
AppHeadwithAppin all.csfiles -
Delete old platform projects and folders
Critical TFM Ordering
<TargetFrameworks>
net9.0-android;net9.0-ios;net9.0-browserwasm;net9.0-desktop;net9.0
</TargetFrameworks>
Never put net9.0 first. VS2022 uses the first TFM for IntelliSense, and net9.0 alone lacks platform APIs. Putting it first causes UNOB0011 and UNOB0013 errors.
.NET Version Upgrades
.NET 8 to .NET 9
- Update
global.jsonto latest Uno.Sdk version - Change all TFMs from
net8.0-*tonet9.0-* - Update
wasm-toolsworkload:dotnet workload install wasm-tools - If using Wasm bootstrapper 8.x, upgrade to 9.x:
- Change SDK from
Microsoft.NET.Sdk.WebtoMicrosoft.NET.Sdk.WebAssembly - Remove
Uno.Wasm.Bootstrap.DevServerpackage - Replace deprecated MSBuild properties (see Wasm skill)
- Change SDK from
Uno.Extensions 5.2+ Breaking Changes
- MSAL:
AddMsal()now requires aWindowparameter - Navigation: Some route registration APIs changed
- Themes: Uno Themes 5.1+ has color naming changes
WPF Migration
Key mapping:
| WPF | Uno Platform |
|---|---|
Window | Page (single-window model) |
{Binding} | {x:Bind} (preferred) or {Binding} |
ICommand | [RelayCommand] or MVUX auto-commands |
DataGrid | ListView / third-party via MAUI Embedding |
System.Windows.* | Microsoft.UI.Xaml.* |
DispatcherInvoke | DispatcherQueue.TryEnqueue |
x:Static | Not supported; use {StaticResource} |
MultiBinding | Not supported; use computed properties |
Silverlight Migration
Uno Platform provides a dedicated migration path. Key changes:
- Silverlight navigation (Page/Frame) maps to Uno Navigation Extensions
- RIA Services replaced with Kiota/Refit HTTP clients
- Silverlight Toolkit controls have Uno Toolkit equivalents
IsolatedStoragereplaced withApplicationData.Current.LocalFolder
Common Build Errors
UNOB0011 / UNOB0013
Cause: net9.0 (base TFM) listed first in TargetFrameworks
Fix: Move platform TFMs before base TFM:
net9.0-android;net9.0-ios;net9.0-browserwasm;net9.0-desktop;net9.0
"The 'MonoAOTCompiler' task was not found"
Cause: Missing wasm-tools workload
Fix: dotnet workload install wasm-tools
"Native WebAssembly assets were detected, but the wasm-tools workload could not be located" (UNOWA0001)
Fix: Run uno-check or dotnet workload install wasm-tools in the project folder
Android build failures
- Java heap space: Add to
.csproj:<JavaMaximumHeapSize>1g</JavaMaximumHeapSize> - SDK version mismatch: Run
uno-checkto verify Android SDK setup - Binding generation errors: Clean and rebuild; check for namespace conflicts
iOS build failures
- Provisioning profile: Ensure valid profile in
Platforms/iOS/Entitlements.plist - Linker errors: Add
[Preserve]attribute to types consumed by reflection - Simulator arch mismatch: Use
net9.0-iossimulatorTFM for simulator builds
Visual Studio 2022 Issues
- IntelliSense errors on valid code: Restart VS2022; check TFM ordering
- Hot Reload not working: Ensure
DOTNET_MODIFIABLE_ASSEMBLIES=debugis set - XAML designer blank: Expected; use Hot Design or Hot Reload instead
- Build succeeds but app crashes: Check Output window for platform-specific errors
Runtime Issues
Blank screen on Wasm
- Check browser console (F12) for JavaScript errors
- Verify MIME types on hosting server (
application/wasmrequired) - Ensure
index.htmlreferences correct bootstrapper path
App crash on Android startup
- Check
adb logcatfor unhandled exceptions - Verify minimum SDK version matches device
- Check for missing permissions in
AndroidManifest.xml
Layout differences across platforms
- Use
SafeAreafor notch/status bar handling - Test responsive breakpoints on each target size
- Skia renderer may render text metrics slightly differently than native
Diagnostic Tools
| Tool | Purpose |
|---|---|
uno-check | Verify environment setup and dependencies |
dotnet workload list | Check installed workloads |
adb logcat | Android runtime logs |
| Browser F12 Console | Wasm runtime errors |
| VS2022 Output Window | Build and runtime diagnostics |
Common Mistakes
- Migrating by hand instead of using
dotnet new unoappas a reference project - Not updating
global.jsonwhen upgrading Uno.Sdk version - Keeping deprecated MSBuild properties from older bootstrapper versions
- Ignoring
uno-checkwarnings about outdated workloads - Copying
App.xaml.cswithout merging customOnLaunchedlogic
Detailed References
- references/01-single-project-migration.md - Read when migrating from multi-project to Single Project structure
- references/02-dotnet-version-upgrade.md - Read when upgrading .NET 8 to 9 or updating Uno.Extensions
- references/03-wpf-silverlight-migration.md - Read when migrating from WPF or Silverlight to Uno Platform
- references/04-common-errors.md - Read when encountering build errors, runtime crashes, or platform-specific issues
