fsprojects / fsprojects/Paket

Simple `dotnet publish` fails with duplicate FSharp.Core.xml error

Open
#4,149 4 comments 0 reactions 0 assignees View on GitHub

Nobody has claimed this yet.

Dominant language
F#
Stars
2.1k
Forks
528
Avg merge
1d 12m
Merged PRs (30d)
54

Description

Description

Given two projects, a netstandard2.0 library and a net6.0 entry point project, dotnet publish freaks out. Not sure if this is a paket issue, an FSharp.Core issue, or a dotnet SDK issue. I'll start it here for now -- I am happy to file this elsewhere if it's not paket's fault.

Repro steps

Please provide the steps required to reproduce the problem

  1. Create A.fsproj (netstandard2.0) and B.fsproj (net6.0)
  2. Make B reference A
  3. Run the app and observe that this works
  4. Attempt to dotnet publish the app and watch it explode

Repro zip: ConsoleApp.zip

Expected behavior

We get a published output.

Actual behavior

We get the following error:

C:\Program Files\dotnet\sdk\7.0.100-preview.2.22153.17\Sdks\Microsoft.NET.Sdk\targets\Microsoft.NET.ConflictResolution.targets(112,5): error NETSDK1152: Found multiple publish output files with the same relative path: C:\Users\jwost\.nuget\packages\fsharp.core\6.0.4\contentFiles\any\netstandard2.0\FSharp.Core.xml, C:\Users\jwost \.nuget\packages\fsharp.core\6.0.4\contentFiles\any\netstandard2.1\FSharp.Core.xml. [C:\Users\jwost\source\repos\ConsoleApp\ConsoleApp\ConsoleApp.fsproj]

(Yes, I have .net 7 preview installed, but it still happens on CI with only .net 6 installed)

More info

content: none from https://github.com/dotnet/fsharp/issues/11143 does not appear to help.

Known workarounds
  • Downgrade to FSharp.Core 5.0.2 or earlier (6.0.0 is the first version broken in this way)
  • OR Make the library target netstandard2.1, though this prevents you from referencing it from a .net framework project
  • OR Multi-target the actual platforms your endpoint projects are targeting (e.g. .net 6 + .net framework 4 in my case) - haven't tried this, but I'm sure it would work

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 ConsoleApp.zip reproduction and run dotnet publish for the netstandard2.0 library referenced by the net6.0 entry point. Inspect the reported Microsoft.NET.ConflictResolution.targets failure and FSharp.Core 6.0.4 contentFiles paths; done when the stated project combination produces published output without the duplicate FSharp.Core.xml error.

Written by the indexing model from the issue text.

Assessment

Tech stack
fsharp
Domain
build-system
Issue type
Bug
Difficulty
4/5
Estimated time
3-5 days
Activity status
Stale
Clarity
Needs clarification
Newbie friendliness
35/100

Get new issues in your inbox

A short digest of beginner-friendly GitHub issues.