Payload contains two or more files with the same destination path 'System.Diagnostics.Tools.dll'

核能气质少年 提交于 2019-12-04 17:43:10

问题


After I add 2 libraries from Nuget to my project I receive follow error:

Error       Payload contains two or more files with the same destination path 'System.Diagnostics.Tools.dll'. Source files: 
C:\Users\Horcrux7\.nuget\packages\runtime.any.System.Diagnostics.Tools\4.0.1\lib\netcore50\System.Diagnostics.Tools.dll
C:\Users\Horcrux7\.nuget\packages\System.Diagnostics.Tools\4.0.0\lib\netcore50\System.Diagnostics.Tools.dll App1            

How can I solve this version conflict?

I have only a very small single UWP project.


回答1:


The problem has solve it self. An update to the latest version of Microsoft.NETCore.UniversalWindowsPlatform has solved it.

It look like that library A was compiled against version 5.1.0 and library B was compiled against version 5.2.2. Because my project was on version 5.1.0 there was a conflict situation. I does not understand why I have no conflict if I switch the UWP version.

If I use the library B with the old UWP version there was also no conflict.




回答2:


Just in case it may be useful to others encountering the same error - "Payload contains two or more files with the same destination path..." - which can be caused by a variety of reasons related to the labyrinth of NuGet packages, one remedy for such NuGet related errors is clearing the cache, or simply deleting the problematic NuGet package folder: C:\Users\user\.nuget\packages\

This is based on my own experience of dealing with similar errors including this particular one.

Edit (2018-07-22): I have been having good luck in dealing with this and similar problems by simply restarting Visual Studio. Probably Microsoft is getting to this bug finally. I get this kind of problems only when building a release version.




回答3:


In my case, I had "Any CPU" option selected so it was compiling the same library for both versions. Selecting x64 solved the problem for me.



来源:https://stackoverflow.com/questions/38593840/payload-contains-two-or-more-files-with-the-same-destination-path-system-diagno

易学教程内所有资源均来自网络或用户发布的内容,如有违反法律规定的内容欢迎反馈
该文章没有解决你所遇到的问题?点击提问,说说你的问题,让更多的人一起探讨吧!