fsprojects / fsprojects/Paket

Dotnet publish with PublishSingleFile=true fails after migrating project to paket

Open
#4,070 0 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

Recently I migrated an F# project from managing dependencies via nuget to paket (using dotnet paket convert-from-nuget). It seems to have worked ok, the project built correctly and everything seemed fine until I tried to publish it as single file:

 dotnet publish -c Release -r linux-x64  --self-contained true -p:PublishSingleFile=true

It failed with this output (shortened line prefixes):

error MSB4018: The "GenerateBundle" task failed unexpectedly. [C:\Users\haim\Code\Personal\roon-tagger\src\RoonTagger.Cli\RoonTagger.Cli.fsproj]
error MSB4018: System.ArgumentException: Invalid input specification: Found multiple entries with the same BundleRelativePath [C:\Users\haim\Code\Personal\roon-tagger\src\RoonTagger.Cli\RoonTagger.Cli.fsproj]
error MSB4018:    at Microsoft.NET.HostModel.Bundle.Bundler.GenerateBundle(IReadOnlyList`1 fileSpecs) [C:\Users\haim\Code\Personal\roon-tagger\src\RoonTagger.Cli\RoonTagger.Cli.fsproj]
error MSB4018:    at Microsoft.NET.Build.Tasks.GenerateBundle.ExecuteCore() [C:\Users\haim\Code\Personal\roon-tagger\src\RoonTagger.Cli\RoonTagger.Cli.fsproj]
error MSB4018:    at Microsoft.NET.Build.Tasks.TaskBase.Execute() [C:\Users\haim\Code\Personal\roon-tagger\src\RoonTagger.Cli\RoonTagger.Cli.fsproj]
error MSB4018:    at Microsoft.Build.BackEnd.TaskExecutionHost.Microsoft.Build.BackEnd.ITaskExecutionHost.Execute() [C:\Users\haim\Code\Personal\roon-tagger\src\RoonTagger.Cli\RoonTagger.Cli.fsproj]
error MSB4018:    at Microsoft.Build.BackEnd.TaskBuilder.ExecuteInstantiatedTask(ITaskExecutionHost taskExecutionHost, TaskLoggingContext taskLoggingContext, TaskHost taskHost, ItemBucket bucket, TaskExecutionMode howToExecuteTask) [C:\Users\haim\Code\Personal\roon-tagger\src\RoonTagger.Cli\RoonTagger.Cli.fsproj]

If I'm running the same command on the commit pre migration it builds correctly.

Repro steps

Please provide the steps required to reproduce the problem

(using .Net 5):

  1. Checkout branch project-changes from this repository
  2. dotnet tool restore
  3. dotnet paket restore
  4. dotnet build
  5. change directory to src\RoonTagger.Cli
  6. dotnet publish -c Release -r linux-x64 --self-contained true -p:PublishSingleFile=true

This should produce the above error

If you try the same publish command on master it should build correctly.

Expected behavior

It should produce single executable :)

Actual behavior

The above mentioned error.

Thanks in advance

Haim

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 reproduction commands and compare the pre-migration and migrated versions of src\RoonTagger.Cli\RoonTagger.Cli.fsproj in the linked roon-tagger repository. Run the single-file publish command and inspect how Paket changes the project inputs reaching the GenerateBundle task. Done means the project publishes a single executable without the duplicate BundleRelativePath 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
Mostly clear
Newbie friendliness
35/100

Get new issues in your inbox

A short digest of beginner-friendly GitHub issues.