Logo Questions Linux Laravel Mysql Ubuntu Git Menu
 

Payload contains two or more files with the same destination path

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

like image 589
ATL_DEV Avatar asked Jan 20 '18 23:01

ATL_DEV


1 Answers

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.

like image 137
Martin Zikmund Avatar answered Nov 15 '22 15:11

Martin Zikmund