Migrating UWP to Windows App SDK (WinUI 3) with Xamarin Forms Integration

pooja_54ebc01c7e0

Pooja Jaiswal

Posted on May 21, 2024

Migrating UWP to Windows App SDK (WinUI 3) with Xamarin Forms Integration

I'm in the process of migrating my project (MyApp.UWP) from UWP to the Windows App SDK (WinUI 3). I'm following the manual migration process as outlined in the Microsoft documentation - https://learn.microsoft.com/en-us/windows/apps/windows-app-sdk/migrate-to-windows-app-sdk/overall-migration-strategy, migrating the project step by step.

My existing UWP project includes Xamarin.Forms references, which I need to incorporate into the WinUI 3 project. However, I am encountering errors such as:

XamlC error XFC0000: Cannot resolve type "Application"
XamlC error XFC0000: Cannot resolve type "Window"

Image description

Solution Structure
My solution consists of three projects:

  1. MyApp: Contains all views and viewmodels.
  2. MyApp.Data: Contains data entities, interfaces, and enums.
  3. MyApp.UWP: The startup project with configuration files, MainPage.xaml, database, and dependency services.

Migration Steps
To migrate, I added a new project named MyApp.WindowsApp. This project will be the new startup project and will need to integrate Xamarin.Forms, Xamarin.Essentials, and Syncfusion Xamarin components. Despite following a step-by-step approach and initially adding minimal dependencies, I'm unable to add the required Xamarin.Forms packages due to the errors mentioned above.

Issues and Request for Assistance
When attempting to add Xamarin.Forms, Xamarin.Essentials, and Syncfusion components to MyApp.WindowsApp, I encounter the XamlC errors. These errors prevent me from proceeding with the integration and setting up MyApp.WindowsApp as the startup project. Specifically, the errors occur when I try to add the NuGet packages for Xamarin.Forms or syncfusion.

Image description

Image description

I would appreciate any guidance on:

How to resolve the XamlC errors related to the "Application" and "Window" types.
The correct way to integrate Xamarin.Forms and related components into a WinUI 3 project.
Best practices for structuring the migration to ensure smooth integration and functionality.

Thank you for your help and insights!

💖 💪 🙅 🚩
pooja_54ebc01c7e0
Pooja Jaiswal

Posted on May 21, 2024

Join Our Newsletter. No Spam, Only the good stuff.

Sign up to receive the latest update from our blog.

Related