Xamarin.forms: [Bug] UWP: Don't generate platform version warnings in class libraries

Created on 13 Jan 2020  路  16Comments  路  Source: xamarin/Xamarin.Forms

Description

If you're building a class library, it's good practice to set both min and max target to the min-version to ensure you don't have to deal with version specific code.
However, Xamarin.Forms generates warnings related to the min version that are completely irrelevant to class libraries

Steps to Reproduce

  1. Create a UWP Class Library and reference Xamarin.Forms
  2. Set min-version and version to 16299
  3. Compile

Expected Behavior

No warning generated in class libraries

Actual Behavior

10>%USER_PROFILE%.nuget\packagesxamarin.forms\4.3.0.991211\build\Xamarin.Forms.targets(195,5): warning : Xamarin.Forms recommends TargetPlatformVersion >= 10.0.17763.0 (current project is 16299)

Basic Information

This is created because of the targets file here:
https://github.com/xamarin/Xamarin.Forms/blob/97901060e8d0028711ce4f3a22c252693f75f7fc/.nuspec/Xamarin.Forms.targets#L184-L198

  • Version with issue: 4.3+
  • Last known good version:
  • IDE: VS2019.4
  • Platform Target Frameworks:

    • iOS:

    • Android:

    • UWP: 16299

  • Android Support Library Version:
  • Nuget Packages:
  • Affected Devices:

Screenshots

image

Reproduction Link

Workaround

2 UWP bug up-for-grabs

Most helpful comment

This is fixed by the following PR

https://github.com/xamarin/Xamarin.Forms/pull/12611

Which is on the most recent 4.8 and 5.0 pre4

All 16 comments

This error now also occurs in Visual Studio 2019 version 16.8.0 when compiling a .NET Standard project that references Xamarin.Forms, 5.0.0.1558-pre3, in my case.

I see the warnings so no need to follow steps to reproduce ;) What's the workaround to eliminate the warnings?

@llaxton afaik there is no workaround. Not sure why this isn't considered a big deal to get fake warnings in your build. Makes it impossible to have a zero tolerance for build warnings

@llaxton afaik there is no workaround. Not sure why this isn't considered a big deal to get fake warnings in your build. Makes it impossible to have a zero tolerance for build warnings

This is not a big deal, this is a huge deal. I have a build I promised a client. It looks like I'll be making the APK on my machine today. ;/

Edit: I resolved the issue on XF 4.8 by updating my nuget restore from 5.5 to 5.8 on the server.

It seems this is fixed in the Xamarin.Forms NuGet package 4.8.0.1687

@vividos this specific UWP issue, or the fact that the warning now also applies to .NET Standard project?

I don't know, I have to try yet. At least the developer community link above days so

I can confirm the warning is gone.

@vividos I looked at the commit, and doesn't seem to change this behavior: https://github.com/xamarin/Xamarin.Forms/commit/68c048504bcda15fc9626e69bf4a9b7027f2d120

Maybe @PureWeen can confirm if he only fixed one or both issues.

This is fixed by the following PR

https://github.com/xamarin/Xamarin.Forms/pull/12611

Which is on the most recent 4.8 and 5.0 pre4

@PureWeen as usual, you rock!

Still seeing this with v4.8.0.1687
image

Can we reopen?

@dotMorten what version of VS are you on?

@PureWeen 16.8.1

@dotMorten can you clean your bin/obj and do a rebuild? I just tested by updated to 1687 and the condition for this warning fails now for me

1>Done building target "AssignLinkMetadata" in project "App40.csproj".
1>Target "WinUICheckTargetPlatformVersion" skipped, due to false condition; ('$(TargetPlatformIdentifier)' == 'UAP' AND '$(TargetPlatformVersion)' != '' AND '$(TargetPlatformMinVersion)' != '') was evaluated as ('Windows' == 'UAP' AND '7.0' != '' AND '7.0' != '').
1>Target "PrepareForBuild" in file "C:\Program Files (x86)\Microsoft Visual Studio\2019\Enterprise\MSBuild\Current\Bin\Microsoft.Common.CurrentVersion.targets":
1>  Using "FindAppConfigFile" task from assembly "Microsoft.Build.Tasks.Core, Version=15.1.0.0, Culture=neutral, PublicKeyToken=b03f5f7f11d50a3a".

Maybe your project has a scenario that isn't accounted for? Can you attach a repro against v4.8.0.1687?

Was this page helpful?
0 / 5 - 0 ratings