runtime: Publishing .net5 winform app gets "Invalid input specification: Found multiple entries with the same BundleRelativePath"
Publishing .net5 winform app to single file gets “Found multiple entries with the same BundleRelativePath”
Seen while publishing with options of: .net5 self-contained win-x64 single file ReadyToRun
… can’t get a clue where multiple entries are, not a hint.
Console output: 15> “GenerateBundle” task failed unexpectedly. 15>System.ArgumentException: Invalid input specification: Found multiple entries with the same BundleRelativePath 15> in Microsoft.NET.HostModel.Bundle.Bundler.GenerateBundle(IReadOnlyList`1 fileSpecs) 15> in Microsoft.NET.Build.Tasks.GenerateBundle.ExecuteCore() 15> in Microsoft.NET.Build.Tasks.TaskBase.Execute() 15> in Microsoft.Build.BackEnd.TaskExecutionHost.Microsoft.Build.BackEnd.ITaskExecutionHost.Execute() 15> in Microsoft.Build.BackEnd.TaskBuilder.<ExecuteInstantiatedTask>d__26.MoveNext()
Publish without “single file” option would not produce this exception.
About this issue
- Original URL
- State: closed
- Created 4 years ago
- Comments: 17 (4 by maintainers)
YES! As it stands, the message is about as useful as “an error occurred”. If you know that entries have the same path, tell me the path!
This is basically a duplicate of multiple issues in runtime and sdk repos. For example: https://github.com/dotnet/runtime/issues/48112 https://github.com/dotnet/sdk/issues/10621 https://github.com/dotnet/sdk/issues/3465
In .NET 6 we improved the error message to contain the file paths which cause the problem. We also allow exact duplicates (we effectively ignore them), as that seems to be by far the most common case.
https://github.com/dotnet/runtime/pull/50476 is the change which allows duplicates when building single-file specifically. https://github.com/dotnet/sdk/issues/16576 tracks a larger SDK problem which may impact any part of the publish pipeline.
You can try to build your app with latest .NET 6 SDK - you don’t need to upgrade your app to .NET 6, just use .NET 6 SDK to build it.
It would help even more if the output indicated how to fix this. I’m seeing this on a project that I can publish fine as framework depending, not single file. The issue seems to be with self-contained publish.
It would help if at least the conflicting paths were given in the error. My case - .NET5 WPF.