fsprojects / fsprojects/Paket

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

Open
#2,829 2 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

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

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

Start with the linked repro-paket-system.net.mail repository and run dotnet restore, dotnet build, and dotnet run for the net461 F# project. Compare its F# and C# variants, including the C# build error, and verify that the final resolution uses System.dll without the duplicate System.Net.Mail assembly.

Written by the indexing model from the issue text.

Assessment

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

Get new issues in your inbox

A short digest of beginner-friendly GitHub issues.