How do I add files to a specific folder inside the zip with MSBuild ExtensionPack Zip?

294 Views Asked by At

I want to copy some files from one project to another project's published zip (don't ask). I've got

  <Target Name="CopyFiles" AfterTargets="_CopyWebApplicationLegacy">
    <ItemGroup>
      <Files Include="$(WebProjectOutputContentDir)\*">
      </Files>
     </ItemGroup>

<MSBuild.ExtensionPack.Compression.Zip 
  TaskAction="AddFiles" 
  CompressFiles="@(Files)" 
  ZipFileName="$(OutDir)\_PublishedWebsites\UserInterface_Package\UserInterface.zip"
  CompressPath="\(huge path)\(destination project)\PackageTmp"
  RemoveRoot="\(huge path)\(source project)"/>
</Target>

This just dumps it to the zip's root folder, though. I need it in the PackageTmp folder.

1

There are 1 best solutions below

0
On

I don't think this is possible with the extension itself, but I copy the file into the correct structure beforehand:

<Copy SourceFiles="@(Files)" DestinationFolder="PackageTmp\" />

Then reference PackageTmp\@(Files) in the CompressFiles call