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

[Bug] Unit Test projects now reference Xamarin.Forms.Platform.WPF #985

@cabal95

Description

@cabal95

Description

I'm not sure if this is a bug per-se, but I couldn't find any previous discussion of it so thought I would mention it as it doesn't "feel right". For our Xamarin Forms project, we have some unit tests that verify some of the business logic works and doesn't break between various upgrades. These are not UI tests. Just a standard netcoreapp3.1 project type for unit testing.

Today I installed Xamarin Community Toolkit and noticed the following warnings appeared:

warning NU1701: Package 'OpenTK 3.0.1' was restored using '.NETFramework,Version=v4.6.1, .NETFramework,Version=v4.6.2, .NETFramework,Version=v4.7, .NETFramework,Version=v4.7.1, .NETFramework,Version=v4.7.2, .NETFramework,Version=v4.8' instead of the project target framework '.NETCoreApp,Version=v3.1'. This package may not be fully compatible with your project.

warning NU1701: Package 'OpenTK.GLControl 3.0.1' was restored using '.NETFramework,Version=v4.6.1, .NETFramework,Version=v4.6.2, .NETFramework,Version=v4.7, .NETFramework,Version=v4.7.1, .NETFramework,Version=v4.7.2, .NETFramework,Version=v4.8' instead of the project target framework '.NETCoreApp,Version=v3.1'. This package may not be fully compatible with your project.

My tests still execute and work fine, but it doesn't seem right that my unit tests project would now be forced to reference a platform lib. I downloaded the latest code from here and verified that the unit test project here does the same.

Is this actually a bug or something we have to live with due to no other way to differentiate WPF from a "generic non-platform" project?

Steps to Reproduce

  1. Create a shared library and install Xamarin Forms 5.0.0 and Community Toolkit 1.0.2 via NuGet.
  2. Create a unit test library that has a project reference to the first project.
  3. Compile, see warnings when NuGet packages are restored.

Expected Behavior

No reference to a platform I'm not using and is not valid for unit testing.

Actual Behavior

Xamarin.Forms.Platform.WPF gets added as a dependency of my Unit Tests project, which chains to the OpenTK package as well.

Basic Information

  • Version with issue: 1.0.2
  • Last known good version: n/a
  • IDE: Visual Studio 2019 16.8.4 Windows 10
  • Platform Target Frameworks:
    • iOS:
    • Android:
    • UWP:
  • Android Support Library Version:
  • Nuget Packages: Xamarin Forms 5.0.0
  • Affected Devices:

Workaround

None so far.

Reproduction imagery

image

Reproduction Link

Let me know if I need to add one, since the unit tests in XCF exhibit the same behavior.

Metadata

Metadata

Assignees

No one assigned

    Labels

    ❗ Breaking ChangeThis issue/PR described a breaking change! Proceed with caution and never merge to current stable!

    Type

    No type
    No fields configured for issues without a type.

    Projects

    No projects

    Milestone

    No milestone

    Relationships

    None yet

    Development

    No branches or pull requests

    Issue actions