Publish error on .Net Core 3.1, "System.ArgumentException: Invalid input specification: Found multiple entries with the same BundleRelativePath"

vivek vishwakarma 1 Reputation point
2021-02-10T15:11:25.32+00:00

Hi, I am facing an issue when trying to publish .Net Core 3.1 project.

I have a Console Application "SampleApp" with target framework as .Net Core 3.1 and another project "SampleApp.Common" as Class Library with target framework as .Net Framework 4.7.2.

I am using WinRT APIs in common project to check whether or not battery saver is ON. When I reference this common project in .Net Core Console app and try to Publish, it fails with following output

2>The "GenerateBundle" task failed unexpectedly.
2>System.ArgumentException: Invalid input specification: Found multiple entries with the same BundleRelativePath
2> at Microsoft.NET.HostModel.Bundle.Bundler.GenerateBundle(IReadOnlyList`1 fileSpecs)
2> at Microsoft.NET.Build.Tasks.GenerateBundle.ExecuteCore()
2> at Microsoft.NET.Build.Tasks.TaskBase.Execute()
2> at Microsoft.NET.Build.Tasks.TaskWithAssemblyResolveHooks.Execute()
2> at Microsoft.Build.BackEnd.TaskExecutionHost.Microsoft.Build.BackEnd.ITaskExecutionHost.Execute()
2> at Microsoft.Build.BackEnd.TaskBuilder.<ExecuteInstantiatedTask>d__26.MoveNext()

I have tried to publish it without referencing the common project and it worked fine. I suspect WinRT APIs are causing the issue.

JFYI, this is just the sample project. My production project has the same project architectures where .Net Core project is used for Azure SignalR Push Notifications. Earlier it used to publish fine when WinRT APIs were not used. But as soon as WinRT APIs are introduced, it failed to publish.

Project is uploaded to OneDrive at https://1drv.ms/u/s!Ah_Q4hxM_dXtgdcx6AKnFBFW7-mlyg?e=iX8v6T

Let me know if you need more details.

Any help is highly appreciated. Thanks

C#
C#
An object-oriented and type-safe programming language that has its roots in the C family of languages and includes support for component-oriented programming.
11,091 questions
0 comments No comments
{count} votes

3 answers

Sort by: Most helpful
  1. Duane Arnold 3,216 Reputation points
    2021-02-10T16:36:25.977+00:00

    That I know about, .NET Core works with .NET Standard. .NET Core does not work with any .NET Framework version.


  2. Duane Arnold 3,216 Reputation points
    2021-02-11T10:27:09.083+00:00

    Your solution may have published fine, but a .NET Core solution hosting and executing a .NET Framework solution, you may find will be unsuccessful.


  3. vivek vishwakarma 1 Reputation point
    2021-02-17T12:09:37.547+00:00

    I was able to publish it fine after following these steps.

    1. Removed reference of .Net Framework Class Library
    2. Referenced .Net Standard Class Library
    3. Removed following references from .Net Standard Class Library project. (A) windows.winmd (B) Windows.Foundation.FoundationContract.winmd (C) Windows.Foundation.UniversalApiContract.winmd (D) System.Runtime.WindowsRuntime.dll
    4. I added following NuGet Package "Microsoft.Windows.SDK.Contracts" to .Net Standard Class Library, mentioned in this doc https://learn.microsoft.com/en-us/windows/apps/desktop/modernize/desktop-to-uwp-enhance#modify-a-net-project-to-use-windows-runtime-apis
    5. Use WinRT APIs
    6. Clean > Rebuild > Publish > It published fine
    0 comments No comments

Your answer

Answers can be marked as Accepted Answers by the question author, which helps users to know the answer solved the author's problem.