fsprojects / fsprojects/Paket

Creating a .Net standard2.0 project that also has Android references seems to create unnecessary transient dependencies

Open
#2,802 10 comments 0 reactions 0 assignees View on GitHub

Nobody has claimed this yet.

bug resolution sdk: dotnet/sdk
Dominant language
F#
Stars
2.1k
Forks
528
Avg merge
1d 12m
Merged PRs (30d)
54

Description

Description

Creating a .Net standard2.0 project that also has Android references to Xamarin.Android.Support.v7.AppCompatseems to create an unnecessary transient dependency toXamarin.Android.Support.v7.AppCompat`.

The .Net standard project references Microsoft.Identity.Client which only has a reference to Xamarin.Android.Support.v7.AppCompat in the MonoAndroid version of the assembly yet dotnet restore seems to try and restore that package.

Repro steps

I created a repo here: https://github.com/7sharp9/paket-mobile-test

clone https://github.com/7sharp9/paket-mobile-test
cd paket-mobile-test
dotnet restore Core
Expected behavior

dotnet restore Core works successfully

Actual behavior

dotnet restore Core fails with

dotnet restore Core                                                                                                                                                
  Restoring packages for /Users/dave.thomas/Documents/paket-mobile-test/Core/Core.fsproj...
/Users/dave.thomas/Documents/paket-mobile-test/Core/Core.fsproj : error NU1202: Package Xamarin.Android.Support.v7.AppCompat 25.4.0.2 is not compatible with netstandard2.0 (.NETStandard,Version=v2.0). Package Xamarin.Android.Support.v7.AppCompat 25.4.0.2 supports: monoandroid70 (MonoAndroid,Version=v7.0)
Known workarounds

?

Contributor guide

No contributing guide indexed for this repository

First steps

  1. Read the whole issue, then the project's contributing guide.
  2. Comment on the issue to say you are picking it up — it saves two people doing the same work.
  3. Fork the repository and make your change on a branch.
  4. Open a pull request that references the issue number.

Research direction

Clone the linked paket-mobile-test repository and run dotnet restore Core for Core/Core.fsproj to reproduce the incompatible Xamarin.Android.Support.v7.AppCompat dependency. Trace how Paket or restore selects dependencies for netstandard2.0 versus MonoAndroid, and consider the issue done when the restore completes without attempting to restore the Android-only package.

Written by the indexing model from the issue text.

Assessment

Tech stack
android, fsharp
Domain
build-system, tooling
Issue type
Bug
Difficulty
4/5
Estimated time
3-5 days
Activity status
Stale
Clarity
Mostly clear
Newbie friendliness
35/100

Get new issues in your inbox

A short digest of beginner-friendly GitHub issues.