UWP project added to Xamarin is not compatible with netstandard2.0

Ganesh Gebhard 366 Reputation points
2021-10-10T01:33:02.297+00:00

Hey!

I have a Xamarin.Forms app (only doing things for Android now) where I added a project from an UWP app. With this, I get two erros which I cannot solve. I've found some things on the internet, but nothing for my specific situation.

The erros are:

Project UWP.Project is not compatible with netstandard2.0 (.NETStandard,Version=v2.0). Project UWP.Project supports: uap10.0.17763 (UAP,Version=v10.0.17763).

Project UWP.Project is not compatible with monoandroid11.0 (MonoAndroid,Version=v11.0). Project UWP.Project supports: uap10.0.17763 (UAP,Version=v10.0.17763).

How do I solve this?

Xamarin
Xamarin
A Microsoft open-source app platform for building Android and iOS apps with .NET and C#.
5,325 questions
Universal Windows Platform (UWP)
0 comments No comments
{count} votes

1 answer

Sort by: Most helpful
  1. Leon Lu (Shanghai Wicresoft Co,.Ltd.) 71,931 Reputation points Microsoft Vendor
    2021-10-11T05:30:18.57+00:00

    Hello,​

    Welcome to our Microsoft Q&A platform!

    What is your versions of xamarin.forms?

    For example, My xamarin.forms version is 5.0.0.2012.

    Then I set the target version is windows 10 version 2004(10.0; build 19041) and minimum version is windows 10, version 1809(10.0; build 17763) like following screenshot.

    139259-image.png

    By the way, if you add the UWP project to the existed Xamarin.forms project. please refer to the following steps.

    1.Click on the Solution and add a new UWP project.

    2.Add to the UWP project this NuGet packaget: Xamarin.Forms.

    3.Click on the Reference in the Portable project and add as reference your UWP project.

    4.Go to the UWP project and open the APP.xaml.cs file and add this line:

       // under this line  
    
       rootFrame.NavigationFailed += OnNavigationFailed;  
    
       // add this line  
    
       Xamarin.Forms.Forms.Init (e); // requires the `e` parameter  
    
    1. From the MainPage.xaml delete the contant of this element <Page> (just a Grid)

    Add this:

    xmlns:forms=”using:Xamarin.Forms.Platform.UWP”

    6 . Change the <Page> to <forms:WindowsPage>

       <forms:WindowsPage  
    
       …  
    
       xmlns:forms=”using:Xamarin.Forms.Platform.UWP”  
    
       …  
    
       </forms:WindowsPage>  
    

    7 . Open the MainPage.xaml.cs and delete this : Page after MainPage class name.

    8 . Add this lane:

       // after this line  
    
       this.InitializeComponent();  
    
       // add this line  
    
       LoadApplication(new YOUR_NAMESPACE.App());  
    

    In the end, please do not forget to add reference for your UWP project.

    139351-image.png 139260-image.png

    When you debug your application, please if you have checked the following settings.

    139268-image.png

    Best Regards,

    Leon Lu


    If the response is helpful, please click "Accept Answer" and upvote it.

    Note: Please follow the steps in our documentation to enable e-mail notifications if you want to receive the related email notification for this thread.