Skip to content
This repository has been archived by the owner on May 1, 2024. It is now read-only.

#3533 Bring back uap10.0/netstandard1.4 support #7079

Merged
merged 18 commits into from
Nov 22, 2019

Conversation

jrjrguo
Copy link
Contributor

@jrjrguo jrjrguo commented Aug 6, 2019

Description of Change

Target netstandard 1.4 in order to support uap10.0.

Issues Resolved

fixes #3533

API Changes

None

Platforms Affected

  • UWP

Behavioral/Visual Changes

None

Before/After Screenshots

Not applicable

Testing Procedure

PR Checklist

  • Has automated tests
  • Rebased on top of the target branch at time of PR
  • Changes adhere to coding standard

@dnfclas
Copy link

dnfclas commented Aug 6, 2019

CLA assistant check
All CLA requirements met.

@rmarinho
Copy link
Member

rmarinho commented Aug 7, 2019

Can't we keep both? netstandard 1.0 and 2.0 ? using multi target ?

@samhouts samhouts changed the title #3533 Bring back uap10.0/netstandard1.4 aupport #3533 Bring back uap10.0/netstandard1.4 support Aug 7, 2019
Copy link
Contributor

@PureWeen PureWeen left a comment

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Build error

D:\a\1\s\Xamarin.Forms.Controls\Xamarin.Forms.Controls.csproj : error : C:\Program Files\dotnet\sdk\2.2.105\Sdks\Msbuild.Sdk.Extras\Sdk not found. Check that a recent enough .NET Core SDK is installed and/or increase the version specified in global.json.
D:\a\1\s\Xamarin.Forms.Controls\Xamarin.Forms.Controls.csproj : error MSB4236: The SDK 'Msbuild.Sdk.Extras/1.3.1' specified could not be found.)

Should we multi target the UWP platform as well to minimize breaking changes?

@kvpt
Copy link
Contributor

kvpt commented Aug 7, 2019

+1 For multi-targeting

.NET Standard 2.0 is always better if possible.

Citations from the .NET Standard documentation.

So generally speaking, consider the following guidelines:

  • You should target the lowest version you can get away with.
  • If you target .NET Standard 1.x, add .NET Standard 2.0 as another target.

The benefits of targeting .NET Standard 2.0 can be summarized as:

  • The dependency graph for .NET Standard 2.0 dependencies is greatly simplified.
  • Consumers of the package running on .NET Standard 2.0 compatible frameworks will need to download fewer package dependencies as a result.

Copy link
Member

@rmarinho rmarinho left a comment

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

We should keep both netstandard 1.0 and 2.0 ? using multi target since this will only build on windows we are fine I think.

<PackageReference Include="Xam.Plugin.DeviceInfo" Version="3.0.2" />
<PackageReference Include="Microsoft.NETCore.UniversalWindowsPlatform" Version="6.0.6" Condition="$(TargetFramework) == 'uap10.0.14393'" />
Copy link
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Is this reference necessary from the shared .NET library (Xamarin.Forms.Controls)?

@jsuarezruiz
Copy link
Contributor

The Build is failing: "Sdk not found".
I think it would be interesting to review the possibility of using Multitargeting.

@samhouts samhouts changed the base branch from master to 4.3.0 August 29, 2019 23:47
@dotMorten
Copy link
Contributor

The Build is failing: "Sdk not found".

I have that issue with the azure pipeline if you use the VS2019 image. Since it's technically no longer supported, that SDK isn't available there.

@PureWeen
Copy link
Contributor

PureWeen commented Sep 5, 2019

  • updated the Controls project slightly so that it works on VSMAC
  • updated SDK Extras to the latest 2.0 version
  • I was able to get passed "Sdk not found" when I ran this on our VS 2019 pipeline @rmarinho

@samhouts samhouts added the blocker Issue blocks next stable release. Prioritize fixing and reviewing this issue. label Nov 20, 2019
@PureWeen PureWeen removed their request for review November 22, 2019 02:51
@PureWeen PureWeen dismissed their stale review November 22, 2019 02:51

not relevant

@jsuarezruiz
Copy link
Contributor

A test is failing, but it is not related with the changes (it is from iOS, ScrollListViewInsideScrollView).

Copy link
Member

@rmarinho rmarinho left a comment

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Looks good, tested the packages and they worked fine on update and run the app.
Notice that it installed WindowsUI package

@rmarinho rmarinho merged commit c0bb38c into xamarin:4.4.0 Nov 22, 2019
@samhouts samhouts added the approved Has two approvals, no pending reviews, and no changes requested label Nov 22, 2019
@samhouts samhouts added this to the 4.4.0 milestone Nov 26, 2019
@Borjamao
Copy link

Not sure my comment in #2859 is placed right:

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:\Dev\examples\App1\App1\App1\MainPage.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
:(

@PureWeen
Copy link
Contributor

@Borjamao

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)

Honestly I am seeing this same error and I haven't figured out how to resolve it. I'm fairly positive there's some combination netstandard libraries, fallbacks, or nuget packages that have to be added but I haven't figured it out. I'm going to poke around (possibly log a bug) see if I can figure out how you're supposed to setup the NS 1.4 library so that it works with UWP

What does (annoyingly) work is if you use a PCL library instead of a netstandard library

@PureWeen
Copy link
Contributor

PureWeen commented Dec 10, 2019

@Borjamao another way you can get it to work is to use multitargeting. If you setup your netstandard library like this, UWP consumes the 14393 target and it runs without any issues

<Project Sdk="Msbuild.Sdk.Extras/2.0.54">
  <PropertyGroup>
    <TargetFramework Condition=" '$(OS)' != 'Windows_NT' ">netstandard2.0</TargetFramework>
    <TargetFrameworks Condition=" '$(OS)' == 'Windows_NT' ">netstandard2.0;uap10.0.14393</TargetFrameworks>
    <TargetPlatformVersion Condition="$(TargetFramework) == 'uap10.0.14393'">10.0.16299.0</TargetPlatformVersion>
    <ProduceReferenceAssembly>true</ProduceReferenceAssembly>
  </PropertyGroup>

  <PropertyGroup Condition="'$(Configuration)|$(Platform)'=='Debug|AnyCPU'">
    <DebugType>portable</DebugType>
    <DebugSymbols>true</DebugSymbols>
  </PropertyGroup>

  <ItemGroup>
    <PackageReference Include="Xamarin.Forms" Version="4.4.0.991220-pre3" />
  </ItemGroup>
</Project>

@Borjamao
Copy link

Thanks @PureWeen, i've been working on this since you wrote, sorry for the delay, i'm facing so many problems with this issue, It seems that the support 1.4 has been bringed back, but nobody propertly tested it, this is my oppinion, because nothing is working as supposed.

It was supposed to work (i think) as my first comment, but it isn't:

Not sure my comment in #2859 is placed right:

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:\Dev\examples\App1\App1\App1\MainPage.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
:(

I worked on your suggestion, installed so many SDKs to support this:

@Borjamao another way you can get it to work is to use multitargeting. If you setup your netstandard library like this, UWP consumes the 14393 target and it runs without any issues

<Project Sdk="Msbuild.Sdk.Extras/2.0.54">
  <PropertyGroup>
    <TargetFramework Condition=" '$(OS)' != 'Windows_NT' ">netstandard2.0</TargetFramework>
    <TargetFrameworks Condition=" '$(OS)' == 'Windows_NT' ">netstandard2.0;uap10.0.14393</TargetFrameworks>
    <TargetPlatformVersion Condition="$(TargetFramework) == 'uap10.0.14393'">10.0.16299.0</TargetPlatformVersion>
    <ProduceReferenceAssembly>true</ProduceReferenceAssembly>
  </PropertyGroup>

  <PropertyGroup Condition="'$(Configuration)|$(Platform)'=='Debug|AnyCPU'">
    <DebugType>portable</DebugType>
    <DebugSymbols>true</DebugSymbols>
  </PropertyGroup>

  <ItemGroup>
    <PackageReference Include="Xamarin.Forms" Version="4.4.0.991220-pre3" />
  </ItemGroup>
</Project>

After a succesful buid in Debug i tested on dev computer. It worked... exciting!

Time to deploy to device with windows 14393, getting an error: Error 0x80073CFD, wich i found that "is the result of trying to install an app that requires a more updated windows 10 build than what your machine has."

So, the objective of beeing able to deploy UWP to devices with Windows 10 ioT Ent2016 LTSB is not reached... This devices are not able to update, so please, do not suggest it...

:(

@PureWeen
Copy link
Contributor

@Borjamao

So, the objective of beeing able to deploy UWP to devices with Windows 10 ioT Ent2016 LTSB is not reached...

I haven't tested on the IoT builds but I have tested on a build of 14393 and it works for me

image

@Borjamao
Copy link

@PureWeen, that means the problem is me! XD

Please, could you tell me wich strategy did you follow to get it working? (multi-target, netstandard1.4, ...). Also, is it a debug or is a appxbundle deploy? An upload of the proyect will be nice

I'm trying to push my organization to use XF in some proyects, but working in this kind of tablets is a must have as they are wide used at industrial environments, your help is appreciated.

Thanks in advance!

@PureWeen
Copy link
Contributor

Here you go @Borjamao

App2.zip

When you open the SLN you'll see it has a NS project and a PCL project

Right now only the NS project is added to the UWP project. I was just testing out both scenarios

For deploying I was just using the remote debugger features of Visual Studio to deploy to the VM I have setup with the 14393 build of windows

@Borjamao
Copy link

Thanks!

I've been playing with your project and creating new projects... All seems to be ok using multitargeting (in debug mode, as release is also having problems, but is not because of this issue)

Thanks for your help!

Sign up for free to subscribe to this conversation on GitHub. Already have an account? Sign in.
Labels
a/carouselview a/collectionview a/Xaml </> approved Has two approvals, no pending reviews, and no changes requested blocker Issue blocks next stable release. Prioritize fixing and reviewing this issue. ControlGallery in-progress This issue has an associated pull request that may resolve it! p/gtk p/UWP partner/cat 😻 t/enhancement ➕
Projects
None yet
Development

Successfully merging this pull request may close these issues.