Payload contains two or more files with the same destination path

烈酒焚心 提交于 2019-12-24 01:44:08

问题


I created a new UWP MSTest Project and I added a reference to my main application. When I build the solution, get the an error:

Payload contains two or more files with the same destination path

Along with the conflicting files. I checked the copy to local for the files and they are set to Do not copy. Here's a sample of the error messages:

Severity Code Description Project File Line Suppression State Error Payload contains two or more files with the same destination path 'Assets\Square44x44Logo.targetsize-24_altform-unplated.png'. Source files: C:\Users\joe.nuget\packages\newtonsoft.json\11.0.1-beta1\lib\netstandard2.0\Newtonsoft.Json.dll C:\Program Files (x86)\Microsoft SDKs\Windows Kits\10\ExtensionSDKs\TestPlatform.Universal\15.5\Redist\CommonConfiguration\neutral\Newtonsoft.Json.dll App.Test C:\Program Files (x86)\Microsoft Visual Studio\2017\Community\MSBuild\Microsoft\VisualStudio\v15.0\AppxPackage\Microsoft.AppXPackage.Targets 1747
Error Payload contains two or more files with the same destination path 'Assets\Wide310x150Logo.scale-200.png'. Source files: E:\App.Test\Assets\Wide310x150Logo.scale-200.png E:\App\Assets\Wide310x150Logo.scale-200.png App.Test C:\Program Files (x86)\Microsoft Visual Studio\2017\Community\MSBuild\Microsoft\VisualStudio\v15.0\AppxPackage\Microsoft.AppXPackage.Targets 1747


回答1:


This happens when the content file names are the same for the app itself and the test project. Even though you set them to Do not copy, they are still conflicting during the intermediate step of building the test project.

The simplest solution is to rename or delete the Asset PNGs inside the Test Project so that they do not conflict with your app itself.

Newtonsoft.Json

Problem with Newtonsoft.Json is a known issue that has been reported to the Visual Studio team and the fix is now pending release.

The only workaround mentioned is the following by Morten Nielsen:

As a workaround and if you can live with the v9 version the test project ships with, you can add a direct assembly reference to the Json.net lib that they use, instead of using the nuget reference.



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

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