Posts Tagged ‘MSBUILD’

PackageWeb Zip Error DestinationFiles refers to 2 item(s), and SourceFiles refers 1

Today I got this error while publishing my web and wcf application in Visual Studio 2013 using PackageWeb Zip Nuget package.

Error “DestinationFiles” refers to 2 item(s), and “SourceFiles” refers to 1 item(s). They must have the same number of items.

This error was generated by the PackageWeb.ZipExtension.targets under the -Package folder specifically by the following statement

<Copy SourceFiles=”$(_ZipPs1)”
Condition=” ‘@(_PkgLoc)’ != ” “/>

I added the Message task before the copy task to view the value of _PkgLoc

<Message Text=”***_PkgLoc:@(_PkgLoc->’%(rootdir)%(directory)'” Importance=”high” />

For some weird reason, the _PkgLoc list had two identical items.  


To fix this error I added the KeepDuplicates attribute to the _PkgLoc tasks as follows:

<_PkgLoc Include=”$(DesktopBuildPackageLocation)” Condition=” ‘$(DesktopBuildPackageLocation)’!=” ” KeepDuplicates=”false” />
<_PkgLoc Include=”$(PackageDestinationRoot)” Condition=” ‘@(_PkgLoc)’==” ” KeepDuplicates=”false”/>

I am not the expert when it comes to MSBuild. If you have a better way to handle this, you can add a comment below

Categories: ALM Tags: , , ,