fsprojects / Paket

A dependency manager for .NET with support for NuGet packages and Git repositories.
https://fsprojects.github.io/Paket/
MIT License
2.02k stars 520 forks source link

.net core version of System.Net.Mail is used when targeting .net461 #2829

Open theimowski opened 6 years ago

theimowski commented 6 years ago

Description

I want to add Suave.Experimental and target net461 but using .net sdk-based project. When referencing System.Net.Mail.MailAddress class, a .net core package System.Net.Mail is added instead of using the standard System.dll 4.0

Repro steps

https://github.com/theimowski/repro-paket-system.net.mail

  1. dotnet restore

  2. dotnet build

  3. dotnet run

Expected behavior

want to print:

System.Net.Mail.MailAddress, System, Version=4.0.0.0, Culture=neutral, PublicKeyToken=b77a5c561934e089

Actual behavior

prints:

System.Net.Mail.MailAddress, System.Net.Mail, Version=1.0.0.0, Culture=neutral, PublicKeyToken=null

Known workarounds

¯\(ツ)

TBH I'm not even sure if this is Paket-related, or rather F#-specific. Same happens if I don't use Paket on F# project: https://github.com/theimowski/repro-paket-system.net.mail/tree/fsharp_nopaket However if I use C# without Paket https://github.com/theimowski/repro-paket-system.net.mail/tree/csharp , I get an error build upon dotnet build:

Program.cs(9,54): error CS0433: The type 'MailAddress' exists in both 'System.Net.Mail, Version=1.0.0.0, Culture=neutral, PublicKeyToken=null' and 'System, Version=4.0.0.0, Culture=neutral, PublicKeyToken=b77a5c561934e089' 

Any guidance would be helpful here

matthid commented 6 years ago

I think this is something interesting and might be related to what happened before regarding assembly versioning and Suave.

matthid commented 6 years ago

Ok maybe it is something entirely different, you can try to

This looks like you might have hit some strange incompat between a netstandard and an existing net461 api.