success GenerateBundle task.
error.
C:\Program Files (x86)\dotnet\sdk\3.0.100-preview8-013656\Sdks\Microsoft.NET.Sdk\targets\Microsoft.NET.Publish.targets(807,5): error MSB4018: "GenerateBundle" task failed unexpectedly. [ ConsoleApp1\ConsoleApp1.csproj]
C:\Program Files (x86)\dotnet\sdk\3.0.100-preview8-013656\Sdks\Microsoft.NET.Sdk\targets\Microsoft.NET.Publish.targets(807,5): error MSB4018: System.ArgumentException: Invalid input specification: Found multiple entries with the same BundleRelativePath [ ConsoleApp1\ConsoleApp1.csproj]
task log file: task_log.txt
I think task parameter "ITaskItem[] FilesToBundle" has duplicate Microsoft.NET.HostModel.Bundle.FileSpec.BundleRelativePath item.
Bundler: Check for duplicate file entries.
C:\Users\name\.nuget\packages\microsoft.vcrtforwarders.140\1.0.1-rc\runtimes\win10-x86\native\debug\concrt140d_app.dll
C:\Users\name\.nuget\packages\microsoft.vcrtforwarders.140\1.0.1-rc\runtimes\win10-x86\native\debug\msvcp140_1d_app.dll
C:\Users\name\.nuget\packages\microsoft.vcrtforwarders.140\1.0.1-rc\runtimes\win10-x86\native\debug\msvcp140_2d_app.dll
C:\Users\name\.nuget\packages\microsoft.vcrtforwarders.140\1.0.1-rc\runtimes\win10-x86\native\debug\msvcp140d_app.dll
C:\Users\name\.nuget\packages\microsoft.vcrtforwarders.140\1.0.1-rc\runtimes\win10-x86\native\debug\vcamp140d_app.dll
C:\Users\name\.nuget\packages\microsoft.vcrtforwarders.140\1.0.1-rc\runtimes\win10-x86\native\debug\vccorlib140d_app.dll
C:\Users\name\.nuget\packages\microsoft.vcrtforwarders.140\1.0.1-rc\runtimes\win10-x86\native\debug\vcomp140d_app.dll
C:\Users\name\.nuget\packages\microsoft.vcrtforwarders.140\1.0.1-rc\runtimes\win10-x86\native\debug\vcruntime140d_app.dll
C:\Users\name\.nuget\packages\microsoft.vcrtforwarders.140\1.0.1-rc\runtimes\win10-x86\native\release\concrt140_app.dll
C:\Users\name\.nuget\packages\microsoft.vcrtforwarders.140\1.0.1-rc\build\netcoreapp2.0\..\..\runtimes\win10-x86\native\release\concrt140_app.dll
C:\Users\name\.nuget\packages\microsoft.vcrtforwarders.140\1.0.1-rc\runtimes\win10-x86\native\release\msvcp140_1_app.dll
C:\Users\name\.nuget\packages\microsoft.vcrtforwarders.140\1.0.1-rc\build\netcoreapp2.0\..\..\runtimes\win10-x86\native\release\msvcp140_1_app.dll
C:\Users\name\.nuget\packages\microsoft.vcrtforwarders.140\1.0.1-rc\runtimes\win10-x86\native\release\msvcp140_2_app.dll
C:\Users\name\.nuget\packages\microsoft.vcrtforwarders.140\1.0.1-rc\build\netcoreapp2.0\..\..\runtimes\win10-x86\native\release\msvcp140_2_app.dll
C:\Users\name\.nuget\packages\microsoft.vcrtforwarders.140\1.0.1-rc\runtimes\win10-x86\native\release\msvcp140_app.dll
C:\Users\name\.nuget\packages\microsoft.vcrtforwarders.140\1.0.1-rc\build\netcoreapp2.0\..\..\runtimes\win10-x86\native\release\msvcp140_app.dll
C:\Users\name\.nuget\packages\microsoft.vcrtforwarders.140\1.0.1-rc\runtimes\win10-x86\native\release\vcamp140_app.dll
C:\Users\name\.nuget\packages\microsoft.vcrtforwarders.140\1.0.1-rc\build\netcoreapp2.0\..\..\runtimes\win10-x86\native\release\vcamp140_app.dll
C:\Users\name\.nuget\packages\microsoft.vcrtforwarders.140\1.0.1-rc\runtimes\win10-x86\native\release\vccorlib140_app.dll
C:\Users\name\.nuget\packages\microsoft.vcrtforwarders.140\1.0.1-rc\build\netcoreapp2.0\..\..\runtimes\win10-x86\native\release\vccorlib140_app.dll
C:\Users\name\.nuget\packages\microsoft.vcrtforwarders.140\1.0.1-rc\runtimes\win10-x86\native\release\vcomp140_app.dll
C:\Users\name\.nuget\packages\microsoft.vcrtforwarders.140\1.0.1-rc\build\netcoreapp2.0\..\..\runtimes\win10-x86\native\release\vcomp140_app.dll
C:\Users\name\.nuget\packages\microsoft.vcrtforwarders.140\1.0.1-rc\runtimes\win10-x86\native\release\vcruntime140_app.dll
C:\Users\name\.nuget\packages\microsoft.vcrtforwarders.140\1.0.1-rc\build\netcoreapp2.0\..\..\runtimes\win10-x86\native\release\vcruntime140_app.dll
The root cause seems to be that there are the same files coming from the Microsoft.NETCore.App
framework as well as the nuget package Microsoft.VCRTForwarders.140
. The weird thing is that the error only happens if the Platform
property is set (to x86 in this case), if that property is left undefined everything works.
@sudoudaisuke Can you please try to simply delete the <Platform>
element from your publish definition XML? For me that seems to workaround the issue.
I also just curious: What is the use case for this package in .NET Core app? (AFAIK all these facades are part of the .NET Core framework, so they should just work in self-contained app).
@swaroop-sridhar - Is this something we should fix in the HostModel
or in the SDK? In HostModel
we could relatively easily normalize all input paths and deduplicate input items. That said it's a bit weird that SDK populates duplicates like this:
C:\Users\name\.nuget\packages\microsoft.vcrtforwarders.140\1.0.1-rc\runtimes\win10-x86\native\release\concrt140_app.dll
C:\Users\name\.nuget\packages\microsoft.vcrtforwarders.140\1.0.1-rc\build\netcoreapp2.0\..\..\runtimes\win10-x86\native\release\concrt140_app.dll
Hmm - digging into this some more - the Microsoft.VCRTForwarders.140
seems to be inflicting this upon itself:
https://github.com/microsoft/vcrt-forwarders/blob/master/Microsoft.VCRTForwarders.140.targets
The targets file they include adds the duplicate items to the ReferenceCopyLocalPaths
, and only does so if the Platform
property is defined. So simple publish from command line actually doesn't invoke those targets - which in itself is probably a bug.
Additionally the native assets (the facades in this case) will be added by NuGet runtime resolution anyway, so there should be no need to add a custom build task to copy them again.
The targets file also has a minor issue with the error message (it supports ARM64, but the error message states x86 and x64 only).
@sudoudaisuke could you please reopen the issue https://github.com/microsoft/vcrt-forwarders/issues/8? (I can't do it myself, probably don't have the right access rights)?
I added some details - in general this feels like something the nuget package should fix.
I'll keep this issue opened for a little bit so that we can discuss if SDK/bundler should be resilient to these kinds of issues or not.
@nguerrera Please look at https://github.com/dotnet/core-setup/issues/7746#issuecomment-521959806
Is the behavior of the package something we should support, or the package should make changes to how it works? (I don't fully know how we resolve assets from NuGet packages in the SDK)
This is the second case of a package with custom targets working around nuget triggering double writes that we're only now unearthing with post processing of publish list.
There's a bug on the sdk to warn and dedupe the list down to the copy that would win. I'll link it when I find it.
Both of the packages are Microsoft owned and I will also follow up with the authors to clean up their packages.
@vitek-karas thanks for investigating this overnight.
@swaroop-sridhar Is this something we should fix in the HostModel or in the SDK? In HostModel we could relatively easily normalize all input paths and deduplicate input items
We've previously agreed that the HostModel must not attempt to fixup such bugs -- because it has no inherent knowledge of which version to choose. So, I added the check (which failed above) to ensure that the problem is caught at build time, rather than getting strange failures at runtime.
Well - in this case the two items are effectively identical (it's the same file, just different syntax of the path)... so there's nothing to choose from (if we would normalize the path, the two items would be identical). But I understand the sentiment - and agree with it.
I will track the work to harden against this with https://github.com/dotnet/sdk/issues/3510
The proposal there is to dedupe down to the same that would survive based on copy order and warn if there are dupes. I will add a note there to conisder not warning if it is a pure dupe (i.e. source and destination paths are the same).
I do not think we should be complicating each individual post-processing tool, but instead heading this off in the sdk.
Duplicate of https://github.com/dotnet/sdk/issues/3510
In the meantime, this question is very relevant:
What is the use case for this package in .NET Core app? (AFAIK all these facades are part of the .NET Core framework, so they should just work in self-contained app).
If you can get away with not referencing this package or conditioning the reference to TargetFramework not being .NET Core, then I would suggest doing that.
If this is not possible, understanding why will help to prioritize https://github.com/dotnet/sdk/issues/3510
Thank you.
I reopened microsoft/vcrt-forwarders#8.
In the meantime, this question is very relevant:
What is the use case for this package in .NET Core app? (AFAIK all these facades are part of the .NET Core framework, so they should just work in self-contained app).
If you can get away with not referencing this package or conditioning the reference to TargetFramework not being .NET Core, then I would suggest doing that.
I was trying to use Microsoft.Toolkit.Wpf.UI.Controls v6.0.0-preview7.1 from WPF .NET Core App. The preview package was target for .NETCoreApp, Version=v3.0.
Nuget package refference is this.
[target for .NETCoreApp, Version=v3.0]
Microsoft.Toolkit.Wpf.UI.Controls - (refer to) -> Microsoft.Toolkit.Wpf.UI.XamlHost - (refer to) -> Microsoft.VCRTForwarders.140
I checked your suggestion. I removed Platform element form csproj then publishing was ok, thank you.
I'm getting this on the release version of net core 3, but I'm not sure how to debug this. Running with -verbosity:diag
doesn't give any extra info, I've tried trimming down packages to try to narrow things down but no luck:
"C:\Users\Nabeel\source\repos\ACARS\AcarsClient\Acars.csproj" (Publish target) (1:7) ->(BundlePublishDirectory target) ->
C:\program files\dotnet\sdk\3.0.100\Sdks\Microsoft.NET.Sdk\targets\Microsoft.NET.Publish.targets(809,5): error MSB4018: The "GenerateBundle" task failed unexpectedly. [C:\Users\Nabeel\source\repos\ACARS\AcarsClient\Acars.csproj]
C:\program files\dotnet\sdk\3.0.100\Sdks\Microsoft.NET.Sdk\targets\Microsoft.NET.Publish.targets(809,5): error MSB4018: System.ArgumentException: Invalid input specification: Found multiple entries with the same BundleRelativePath [C:\Users\Nabeel\source\repos\ACARS\AcarsClient\Acars.csproj]
C:\program files\dotnet\sdk\3.0.100\Sdks\Microsoft.NET.Sdk\targets\Microsoft.NET.Publish.targets(809,5): error MSB4018: at Microsoft.NET.HostModel.Bundle.Bundler.GenerateBundle(IReadOnlyList`1 fileSpecs) [C:\Users\Nabeel\source\repos\ACARS\AcarsClient\Acars.csproj]
C:\program files\dotnet\sdk\3.0.100\Sdks\Microsoft.NET.Sdk\targets\Microsoft.NET.Publish.targets(809,5): error MSB4018: at Microsoft.NET.Build.Tasks.GenerateBundle.ExecuteCore() [C:\Users\Nabeel\source\repos\ACARS\AcarsClient\Acars.csproj]
C:\program files\dotnet\sdk\3.0.100\Sdks\Microsoft.NET.Sdk\targets\Microsoft.NET.Publish.targets(809,5): error MSB4018: at Microsoft.NET.Build.Tasks.TaskBase.Execute() [C:\Users\Nabeel\source\repos\ACARS\AcarsClient\Acars.csproj]
C:\program files\dotnet\sdk\3.0.100\Sdks\Microsoft.NET.Sdk\targets\Microsoft.NET.Publish.targets(809,5): error MSB4018: at Microsoft.Build.BackEnd.TaskExecutionHost.Microsoft.Build.BackEnd.ITaskExecutionHost.Execute() [C:\Users\Nabeel\source\repos\ACARS\AcarsClient\Acars.csproj]
C:\program files\dotnet\sdk\3.0.100\Sdks\Microsoft.NET.Sdk\targets\Microsoft.NET.Publish.targets(809,5): error MSB4018: at Microsoft.Build.BackEnd.TaskBuilder.ExecuteInstantiatedTask(ITaskExecutionHost taskExecutionHost, TaskLoggingContext taskLoggingContext, TaskHost taskHost, ItemBucket bucket, TaskExecutionMode howToExecuteTask) [C:\Users\Nabeel\source\repos\ACARS\AcarsClient\Acars.csproj]
And the list
<ItemGroup>
<PackageReference Include="Autoupdater.NET.Official" Version="1.5.7" />
<PackageReference Include="CommonServiceLocator" Version="2.0.4" />
<PackageReference Include="ConcurrentHashSet" Version="1.1.0" />
<PackageReference Include="ControlzEx" Version="4.1.0" />
<PackageReference Include="DiscordRichPresence" Version="1.0.121" />
<PackageReference Include="FSUIPCClientDLL" Version="3.1.11" />
<PackageReference Include="GMap.Net.WPF" Version="1.0.0.1" />
<PackageReference Include="LiteDB" Version="4.1.4" />
<PackageReference Include="MahApps.Metro" Version="2.0.0-alpha0490" />
<PackageReference Include="MahApps.Metro.SimpleChildWindow" Version="2.0.0-alpha0027" />
<PackageReference Include="MaterialDesignColors" Version="1.2.1-ci581" />
<PackageReference Include="MaterialDesignThemes" Version="3.0.0-ci581" />
<PackageReference Include="MaterialDesignThemes.MahApps" Version="0.1.1-ci581" />
<PackageReference Include="Microsoft.AppCenter" Version="2.4.0-preview" />
<PackageReference Include="Microsoft.AppCenter.Analytics" Version="2.4.0-preview" />
<PackageReference Include="Microsoft.AppCenter.Crashes" Version="2.4.0-preview" />
<PackageReference Include="Newtonsoft.Json" Version="12.0.2" />
<PackageReference Include="NLog" Version="4.6.7" />
<PackageReference Include="NLog.Config" Version="4.6.7" />
<PackageReference Include="NLog.Schema" Version="4.6.7" />
<PackageReference Include="Polly" Version="7.1.1" />
<PackageReference Include="Prism.Core" Version="7.2.0.1367" />
<PackageReference Include="Prism.Unity" Version="7.2.0.1367" />
<PackageReference Include="Prism.Wpf" Version="7.2.0.1367" />
<PackageReference Include="RestSharp" Version="106.6.10" />
<PackageReference Include="Scriban" Version="2.1.0" />
<PackageReference Include="SharpCompress" Version="0.24.0" />
<PackageReference Include="Splat" Version="9.0.5" />
<PackageReference Include="sqlite-net-pcl" Version="1.6.292" />
<PackageReference Include="SQLitePCLRaw.bundle_e_sqlite3" Version="1.1.14" />
<PackageReference Include="SQLitePCLRaw.core" Version="1.1.14" />
<PackageReference Include="SQLitePCLRaw.provider.e_sqlite3.net45" Version="1.1.14" />
<PackageReference Include="Stateless" Version="4.2.1" />
<PackageReference Include="Unity" Version="5.11.1" />
</ItemGroup>
This is the second case of a package with custom targets working around nuget triggering double writes that we're only now unearthing with post processing of publish list.
There's a bug on the sdk to warn and dedupe the list down to the copy that would win. I'll link it when I find it.
Both of the packages are Microsoft owned and I will also follow up with the authors to clean up their packages.
I was finding same problem with "Microsoft.Azure.Cosmos" 3.0.0 package
https://github.com/dotnet/sdk/issues/3465#issuecomment-540019070
This is still a problem on Released Core 3.
Note that it also highlights lack of logging - the error details should include the offending files
Same here :(
I'm also having build errors which hint towards this issue.
Running dotnet publish -r win-x64 -c Release --self-contained -o C:\Path reports following error:
_C:\Users\user.nuget\packages\fody\6.0.5\build\Fody.targets(40,5): error MSB4062: Die Fody.WeavingTask-Aufgabe konnte nicht aus der C:\Users\user.nuget\packages\fody\6.0.5\build..\netstandardtask\Fody.dll-Assembly geladen werden. Assembly with same name is already loaded Stellen Sie sicher, dass die
All projects are referencing the same package/version.
Hello
same problem with .NET Core 3.1
1>------ Build started: Project: Rescue.SMSAruba, Configuration: Debug Any CPU ------
1>Rescue.SMSAruba ->
>/r "C:\Users\julian\.nuget\packages\microsoft.netcore.app.runtime.win-x64\3.1.0\runtimes\win-x64\lib\netcoreapp3.1\netstandard.dll"
4>/r "C:\Users\julian\.nuget\packages\microsoft.netcore.app.runtime.win-x64\3.1.0\runtimes\win-x64\native\System.Private.CoreLib.dll"
4>/out "obj\Debug\netcoreapp3.1\win-x64\R2R\Rescue.Reverse.Tunnel.Server.dll"
4>"obj\Debug\netcoreapp3.1\win-x64\Rescue.Reverse.Tunnel.Server.dll"
4>
4>The "GenerateBundle" task failed unexpectedly.
4>System.ArgumentException: Invalid input specification: Found multiple entries with the same BundleRelativePath
4> at Microsoft.NET.HostModel.Bundle.Bundler.GenerateBundle(IReadOnlyList`1 fileSpecs)
4> at Microsoft.NET.Build.Tasks.GenerateBundle.ExecuteCore()
4> at Microsoft.NET.Build.Tasks.TaskBase.Execute()
4> at Microsoft.Build.BackEnd.TaskExecutionHost.Microsoft.Build.BackEnd.ITaskExecutionHost.Execute()
4> at Microsoft.Build.BackEnd.TaskBuilder.<ExecuteInstantiatedTask>d__26.MoveNext()
========== Build: 3 succeeded, 0 failed, 0 up-to-date, 0 skipped ==========
========== Publish: 0 succeeded, 1 failed, 0 skipped ==========
<Project Sdk="Microsoft.NET.Sdk">
<PropertyGroup>
<OutputType>Exe</OutputType>
<TargetFramework>netcoreapp3.1</TargetFramework>
<LangVersion>latest</LangVersion>
<Version>0.2.15</Version>
</PropertyGroup>
<ItemGroup>
<Compile Remove="bin\Debug\netcoreapp3.1\**" />
<EmbeddedResource Remove="bin\Debug\netcoreapp3.1\**" />
<None Remove="bin\Debug\netcoreapp3.1\**" />
</ItemGroup>
<ItemGroup>
<None Include="bin\Debug\netcoreapp3.1\run.bat" />
</ItemGroup>
<ItemGroup>
<PackageReference Include="NetMQ" Version="4.0.0.207" />
<PackageReference Include="Newtonsoft.Json" Version="12.0.3" />
<PackageReference Include="NLog" Version="4.6.8" />
<PackageReference Include="NLog.Config" Version="4.6.8" />
<PackageReference Include="Polly" Version="7.2.0" />
</ItemGroup>
<ItemGroup>
<ProjectReference Include="..\Rescue.Reverse.Tunnel\Rescue.Reverse.Tunnel.csproj">
<Private>true</Private>
</ProjectReference>
</ItemGroup>
<ItemGroup>
<None Update="NLog.config">
<CopyToOutputDirectory>Always</CopyToOutputDirectory>
</None>
</ItemGroup>
</Project>
.NET Core 3.1
Please fix this : (
C:\Program Files\dotnet\sdk\3.1.101\Sdks\Microsoft.NET.Sdk\targets\Microsoft.NET.Publish.targets(868,5): error MSB4018: The "GenerateBundle" task failed unexpectedly. [C:\Users\Crauzer\Documents\Fantome\Fantome\Fantome\Fantome.csproj]
C:\Program Files\dotnet\sdk\3.1.101\Sdks\Microsoft.NET.Sdk\targets\Microsoft.NET.Publish.targets(868,5): error MSB4018: System.ArgumentException: Invalid input specification: Found multiple entries with the same BundleRelativePath [C:\Users\Crauzer\Documents\Fantome\Fantome\Fantome\Fantome.csproj]
C:\Program Files\dotnet\sdk\3.1.101\Sdks\Microsoft.NET.Sdk\targets\Microsoft.NET.Publish.targets(868,5): error MSB4018: at Microsoft.NET.HostModel.Bundle.Bundler.GenerateBundle(IReadOnlyList`1 fileSpecs) [C:\Users\Crauzer\Documents\Fantome\Fantome\Fantome\Fantome.csproj]
C:\Program Files\dotnet\sdk\3.1.101\Sdks\Microsoft.NET.Sdk\targets\Microsoft.NET.Publish.targets(868,5): error MSB4018: at Microsoft.NET.Build.Tasks.GenerateBundle.ExecuteCore() [C:\Users\Crauzer\Documents\Fantome\Fantome\Fantome\Fantome.csproj]
C:\Program Files\dotnet\sdk\3.1.101\Sdks\Microsoft.NET.Sdk\targets\Microsoft.NET.Publish.targets(868,5): error MSB4018: at Microsoft.NET.Build.Tasks.TaskBase.Execute() [C:\Users\Crauzer\Documents\Fantome\Fantome\Fantome\Fantome.csproj]
C:\Program Files\dotnet\sdk\3.1.101\Sdks\Microsoft.NET.Sdk\targets\Microsoft.NET.Publish.targets(868,5): error MSB4018: at Microsoft.Build.BackEnd.TaskExecutionHost.Microsoft.Build.BackEnd.ITaskExecutionHost.Execute() [C:\Users\Crauzer\Documents\Fantome\Fantome\Fantome\Fantome.csproj]
C:\Program Files\dotnet\sdk\3.1.101\Sdks\Microsoft.NET.Sdk\targets\Microsoft.NET.Publish.targets(868,5): error MSB4018: at Microsoft.Build.BackEnd.TaskBuilder.ExecuteInstantiatedTask(ITaskExecutionHost taskExecutionHost, TaskLoggingContext taskLoggingContext, TaskHost taskHost, ItemBucket bucket, TaskExecutionMode howToExecuteTask) [C:\Users\Crauzer\Documents\Fantome\Fantome\Fantome\Fantome.csproj]
For those with package "NLog.Config"
modify your package reference as follows - this helps in my case
<PackageReference Include="NLog.Config" Version="4.6.8">
<ExcludeAssets>all</ExcludeAssets>
</PackageReference>
For those with package "NLog.Config"
modify your package reference as follows - this helps in my case<PackageReference Include="NLog.Config" Version="4.6.8"> <ExcludeAssets>all</ExcludeAssets> </PackageReference>
this help me for this issue! thanks
Why is this closed? This is happening for me with version 2.0.54
This is a package configuration issue. Probably some of nuget components should be set as transitive (just my wild guess without digging into that)
https://www.erikheemskerk.nl/transitive-nuget-dependencies-net-core-got-your-back/
I've been having this problem in some of my projects.
After a lot of investigation I concluded that it only happens with one library: System.Data.Sqlite.Core. This library, when publishing, creates a runtimes directory that has, for each runtime, 2 folders with an Interop lib for netstandard2.0 and netstandard2.1. The fact that it has these 2 libs causes the "Found multiple entries with the same BundleRelativePath" error. I think it tries to copy the 2 libs instead of selecting the more appropriate (for my project it would probably be netstandard2.1).
Unfortunately, there isn鈥檛 a way to specify which runtime to use for a lib in the PackageReference. I鈥檝e tried everything buy I always get this error.
Any help would be appreciated.
This is still occurring. I had published a single-file a few days ago. I've made a few code changes since, but no new packages or package configuration changes. Now I'm faced with this bundle issue when I try to publish.
EDIT: Adding <CopyLocalLockFileAssemblies>false</CopyLocalLockFileAssemblies>
to my .csproj solves the publish issue. Just have to toggle it on and off (or comment/uncomment) when working in VS versus publishing a build.
I found a root cause for this error.
In my project I have multiple entry points, one in the project and second from Microsoft.NET.Test.Sdk.
The project compiles fine with <StartupObject>
defined but publishing fails.
I've been having this problem in some of my projects.
After a lot of investigation I concluded that it only happens with one library: System.Data.Sqlite.Core. This library, when publishing, creates a runtimes directory that has, for each runtime, 2 folders with an Interop lib for netstandard2.0 and netstandard2.1. The fact that it has these 2 libs causes the "Found multiple entries with the same BundleRelativePath" error. I think it tries to copy the 2 libs instead of selecting the more appropriate (for my project it would probably be netstandard2.1).
Unfortunately, there isn鈥檛 a way to specify which runtime to use for a lib in the PackageReference. I鈥檝e tried everything buy I always get this error.
Any help would be appreciated.
same
For those finding this issue, here's a hacky workaround for SQLite until this gets fixed. The idea is to override the MSBuild target that creates the bundle and remove the offending duplicate SQLite file. If you're building cross-platform you might need to adapt the path. Also note that the SDK _cannot_ be specified as a Project attribute or it wouldn't be possible to overwrite the existing target BundlePublishDirectory
.
<Project>
<Import Sdk="Microsoft.NET.Sdk" Project="Sdk.Props" />
<PropertyGroup>
<OutputType>Exe</OutputType>
<SelfContained>True</SelfContained>
<PublishSingleFile>True</PublishSingleFile>
</PropertyGroup>
<Import Sdk="Microsoft.NET.Sdk" Project="Sdk.Targets" />
<Target Name="BundlePublishDirectory"
Condition="'$(PublishSingleFile)' == 'true'"
DependsOnTargets="_ComputeFilesToBundle"
Inputs="@(_FilesToBundle)"
Outputs="$(PublishedSingleFilePath)">
<!-- Workaround for https://system.data.sqlite.org/index.html/tktview/ba4a3a4ac5e06a406b98f1cfc5ac517bef2a9f57 -->
<ItemGroup>
<_FilesToBundleWithoutSqlite Include="@(_FilesToBundle)"
Condition="!$([System.Text.RegularExpressions.Regex]::IsMatch('%(Identity)', '.\\native\\netstandard2.0\\SQLite.Interop.dll'))" />
</ItemGroup>
<GenerateBundle FilesToBundle="@(_FilesToBundleWithoutSqlite)"
AppHostName="$(PublishedSingleFileName)"
IncludeSymbols="$(IncludeSymbolsInSingleFile)"
OutputDir="$(PublishDir)"
ShowDiagnosticOutput="false" />
</Target>
...
</Project>
For people using NLog(.Config). This was the problem for me. As mentioned above changing ExcludeAssets might make it work.
I switched from NLog.Config as the only package to NLog, without .Config, which fixed it.
So
<PackageReference Include="NLog.Config" Version="4.7.5" />
->
<PackageReference Include="NLog" Version="4.7.5" />
Most helpful comment
This is still a problem on Released Core 3.
Note that it also highlights lack of logging - the error details should include the offending files