Paket icon indicating copy to clipboard operation
Paket copied to clipboard

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

Open babysnakes opened this issue 4 years ago • 0 comments

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

babysnakes avatar Aug 13 '21 06:08 babysnakes