Xamarin.forms: UWP build fails when minimum version is Anniversary Update or lower

Created on 29 May 2018  路  16Comments  路  Source: xamarin/Xamarin.Forms

Description

Compiling a UWP project that has a minimum version set to Windows 10 Anniversary Update or lower will fail when using Xamarin.Forms 3.0. This is because there is now a dependency on .NET Standard 2.0 for UWP which is only supported when using a minimum version of Fall Creator's Update or higher.

To prevent this, the UWP target framework version in the nuspec should be updated to 10.0.15138 like in the Microsoft.NETCore.UniversalWindowsPlatform package.

Also reported here: https://developercommunity.visualstudio.com/content/problem/256382/netstandard-compatibility.html

Steps to Reproduce

  1. Create a new Xamarin.Forms project using a shared project
  2. In the UWP project's properties, change the Minimum version to Windows 10 Anniversary Update or lower
  3. Build the UWP project

Expected Behavior

The build will complete successfully

Actual Behavior

The build fails with several errors such as

The type 'Type' is defined in an assembly that is not referenced. You must add a reference to assembly 'netstandard, Version=2.0.0.0, Culture=neutral, PublicKeyToken=cc7b13ffcd2ddd51'
The type 'Object' is defined in an assembly that is not referenced. You must add a reference to assembly 'netstandard, Version=2.0.0.0, Culture=neutral, PublicKeyToken=cc7b13ffcd2ddd51'

Basic Information

  • Version with issue: 3.0+
  • Last known good version: 2.5 series
  • IDE: VS2017
  • Platform Target Frameworks:

    • UWP:

    • Min version: Anniversary update, build 14393

    • Target version: April 2018 update, build 17134

6 help wanted high inactive bug up-for-grabs

Most helpful comment

Is there any Progress on this? And stupid Question from my side: couldn't you provide a second nuget where you drop netstandard 1.0 (if this would solve this issue?)

It is so sad to see that Windows 10 Mobile can't be served with Xamarin Forms 3.0 due to the fact that it doesn't support .net Standard 2.0. Xamarin was intended to support all Major platforms and the root platform for mobile .Net (W10M) is not supported anymore. It's a shame!

All 16 comments

Can be fixed in 3.1?

+1 @jassmith I appreciate if you could tell us when you expect the release of this fix as we can't target 3 because of this

10.0.15138 is lower than 15254 where Win10 mobile hangs. So could this bring .net standard 2.0 support to mobile and we can use Xamarin Forms 3.x when supporting mobile apps?

Can we get clarification about what the outcome of this bug fix should be? Are you hoping to be able to run Xamarin.Forms 3.0+ on builds < 10.0.15138, or are you hoping that updating projects to Xamarin.Forms 3.0+ will set the minimum version of the UWP project to 10.0.15138?

yes we all want to run xamarin forms 3 on builds <16299 ((Fall Creators Update) we want xamarin forms to support at least Build 14393 (Anniversary Update) because we want to use the new features like RTL

We moved Xamarin.Forms to .NET standard with #1306 and #1649. As noted in this issue's description, UWP does not support .NET Standard until Fall Creator's Update. This is an expected breaking change, and there is, unfortunately, no trivial resolution that would allow Xamarin.Forms 3.0 to run on targets < FCU.

@samhouts UWP for Windows versions less than 10.0.15138 supports .NET Standard 1.4, but not .NET Standard 2.0. It looks like it was a Xamarin.Forms 3.0 switch to relying on .NET Standard 2.0. This means that Xamarin.Forms 3.0 can't produce apps that run on Microsoft Surface Hub devices unfortunately, because the OS that runs on those is based on Windows 10.0.15063, and this is not likely to change.

@samhouts, reading @RadwanIbrahim's comments above it sounds like this issue is about Xamarin.Forms 3.0+ on builds < 10.0.15138. Is there any chance that this will be tackled? Do you have a response to my points above?

The intent of this issue was not to make XF 3.0 compatible with lower UWP targets. If that is desired, a new issue should be opened for that. It is not a trivial task, and it would need to be prioritized. Thanks!

@jimmgarrido This isn't really behaving the way I would expect it to. Waiting on some guidance in https://github.com/NuGet/Home/issues/7205.

@jimmgarrido Since we support netstandard1.0 on other platforms, we include that as a target. Unfortunately, that means that UWP is picking up the install from that folder, so this change does nothing. We won't be able to truly limit the UWP target version until we do the work to resolve #3533 or we drop netstandard 1.0.

Is there any Progress on this? And stupid Question from my side: couldn't you provide a second nuget where you drop netstandard 1.0 (if this would solve this issue?)

It is so sad to see that Windows 10 Mobile can't be served with Xamarin Forms 3.0 due to the fact that it doesn't support .net Standard 2.0. Xamarin was intended to support all Major platforms and the root platform for mobile .Net (W10M) is not supported anymore. It's a shame!

Hi, any progress here?

Is there any way to get a Xamarin.Forms UWP application working in a tablet wich Windows 10 version is below FCU? It's wired you can develop against android, ios, but no some windows 10 with xamarin forms!

Support of Windows 10 build 14393 with .NET Standard 1.4 is back on XF 4.4: https://github.com/xamarin/Xamarin.Forms/pull/7079

Issue to support Windows 10 build 10240: https://github.com/xamarin/Xamarin.Forms/issues/8570

@samhouts I think this issue can be closed on XF 4.4 by #7079

Hi,

I shoud be doing something wrong, but still no working... My steps (probably more than are needed and less than required):

  • Updated to VS2019 (16.4.0)
  • Created a Xamarin.Forms Mobile app project (Android and iOS).
  • Manage nuget packages, updating Xamarin.Forms to 4.4.0.99120-pre3
  • Changed c# project -> "netstandard1.4".
    -Tried to build, error:
    Severity Code Description Project File Line Suppression State
    Error CS0246 The type or namespace name 'DesignTimeVisibleAttribute' could not be found (are you missing a using directive or an assembly reference?) App1 F:DevexamplesApp1App1App1MainPage.xaml.cs 13 Active
  • Changed MainPage.xaml.cs "[DesignTimeVisible(false)]" -> "//[DesignTimeVisible(false)]", then project compiled ok (?).
  • Android project compiled ok, app worked on emulator.
  • Add new "Blank App (Universal Windows)" c# project, Target version "Windows 10 version 1903 (10.0;Build 18362)", Minimum version:"Windows 10 Anniversary Update (10.0; Build 14393).
  • Followed from point 3 of "https://docs.microsoft.com/en-us/xamarin/xamarin-forms/platform/windows/installation/index" to the end
  • Build UWP project.
  • Started Break -> global::System.Diagnostics.Debugger.Break():
    System.Reflection.TargetInvocationException: Exception has been thrown by the target of an invocation. ---> System.IO.FileLoadException: Could not load file or assembly 'System, Version=4.0.0.0, Culture=neutral, PublicKeyToken=b77a5c561934e089'. The located assembly's manifest definition does not match the assembly reference. (Exception from HRESULT: 0x80131040)
    at App1.App.InitializeComponent()
    at App1.App..ctor()
    at App1_UWP.MainPage..ctor()
    --- End of inner exception stack trace ---
    a

:(

Was this page helpful?
0 / 5 - 0 ratings