That I know about, .NET Core works with .NET Standard. .NET Core does not work with any .NET Framework version.
Publish error on .Net Core 3.1, "System.ArgumentException: Invalid input specification: Found multiple entries with the same BundleRelativePath"
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
3 answers
Sort by: Most helpful
-
-
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.
-
vivek vishwakarma 1 Reputation point
2021-02-17T12:09:37.547+00:00 I was able to publish it fine after following these steps.
- Removed reference of .Net Framework Class Library
- Referenced .Net Standard Class Library
- 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
- 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
- Use WinRT APIs
- Clean > Rebuild > Publish > It published fine