MSBuild "Zip" 任务不支持 "WorkingDirectory" 参数

MSBuild The "WorkingDirectory" parameter is not supported by the "Zip" task

在 MSBuild 中,我的 .xml 文件包含以下内容:

 <Target Name="Zip">
<ItemGroup>
    <WorkingDirect Include="$(DeployDirectory)$(PackagePrefix)$(PackageFolder)"/>
  </ItemGroup>
        <CreateItem Include="$(DeployDirectory)$(PackagePrefix)$(PackageFolder)\*.*" >
                <Output ItemName="ZipFiles" TaskParameter="Include"/>
        </CreateItem>
<Message Text="@(WorkingDirect)" Importance="High" />
        <Zip ZipFileName="YourZipFile.zip" WorkingDirectory="@(WorkingDirect)" Files="@(ZipFiles)" />
</Target>

在论坛上有人说为了压缩我需要在上面添加的部署包。但是我收到以下错误:

[15:54:50][Zip] C:\TeamCity\buildAgent\work\c14fc97466c6d06e****cmss.xml(148, 44): error MSB4064: The "WorkingDirectory" parameter is not supported by the "Zip" task. Verify the parameter exists on the task, and it is a settable public instance property.
[15:54:50][Zip] C:\TeamCity\buildAgent\work\c14fc97466c6d06e****cmss.xml(148, 9): error MSB4063: The "Zip" task could not be initialized with its input parameters. 
[15:54:50][Step 1/1] Process exited with code 1

但是在 build.log 中似乎参数设置正确:

[Zip] C:\DeployPackages\**150725_155148

我找了好久,请问有人能帮帮我吗???

提前致谢...

现在一切都很好;非常感谢我的老板 :) 他向我发送了 link 的正确用法。对于因从部署包创建 zip 文件而受苦的任何人:(http://www.msbuildextensionpack.com/help/3.5.14.0/index.html)

<Project ToolsVersion="3.5" DefaultTargets="Default" xmlns="http://schemas.microsoft.com/developer/msbuild/2003">
  <PropertyGroup>
    <TPath>$(MSBuildProjectDirectory)\..\MSBuild.ExtensionPack.tasks</TPath>
    <TPath Condition="Exists('$(MSBuildProjectDirectory)\..\..\Common\MSBuild.ExtensionPack.tasks')">$(MSBuildProjectDirectory)\..\..\Common\MSBuild.ExtensionPack.tasks</TPath>
  </PropertyGroup>
  <Import Project="$(TPath)"/>
  <Target Name="Default" DependsOnTargets="Sample1;Sample2"/>
  <Target Name="Sample1">
    <ItemGroup>
      <!-- Set the collection of files to Zip-->
      <FilesToZip Include="C:\Patches\**\*"/>
    </ItemGroup>
    <!-- Create a zip file based on the FilesToZip collection -->
    <MSBuild.ExtensionPack.Compression.Zip TaskAction="Create" CompressFiles="@(FilesToZip)" ZipFileName="C:\newZipByFile.zip"/>
    <MSBuild.ExtensionPack.Compression.Zip TaskAction="Create" Password="apassword" CompressionLevel="BestCompression" RemoveRoot="C:\Patches" CompressFiles="@(FilesToZip)" ZipFileName="C:\newZipByFileBestCompression.zip"/>
    <!-- Create a zip file based on a Path -->
    <MSBuild.ExtensionPack.Compression.Zip TaskAction="Create" CompressPath="C:\Patches" ZipFileName="C:\newZipByPath.zip"/>
    <!-- Extract a zip file-->
    <MSBuild.ExtensionPack.Compression.Zip TaskAction="Extract" ExtractPath="C:\aaa11" ZipFileName="C:\newZipByFile.zip"/>
    <MSBuild.ExtensionPack.Compression.Zip TaskAction="Extract" ExtractPath="C:\aaa11" ZipFileName="C:\newZipByPath.zip"/>
    <MSBuild.ExtensionPack.Compression.Zip TaskAction="Extract" Password="apassword"  ExtractPath="C:\aaa11" ZipFileName="C:\newZipByFileBestCompression.zip"/>
  </Target>
  <Target Name="Sample2">
    <PropertyGroup>
      <SourceDirectory>MotorData\</SourceDirectory>
    </PropertyGroup>
    <ItemGroup>
      <Files Include="$(SourceDirectory)*" Exclude="$(SourceDirectory).XYZ\**\*">
        <Group>Common</Group>
      </Files>
      <Files Include="$(SourceDirectory)Cars\*" Exclude="$(SourceDirectory)Cars\.XYZ\**\*">
        <Group>Cars</Group>
      </Files>
      <Files Include="$(SourceDirectory)Trucks\*" Exclude="$(SourceDirectory)Trucks\.XYZ\**\*">
        <Group>Trucks</Group>
      </Files>
    </ItemGroup>
    <!-- Create the output folder -->
    <ItemGroup>
      <OutputDirectory Include="output\"/>
    </ItemGroup>
    <MakeDir Directories="@(OutputDirectory)"/>
    <PropertyGroup>
      <WorkingDir>%(OutputDirectory.Fullpath)</WorkingDir>
    </PropertyGroup>
    <!-- Zip files based on the group they belong to -->
    <MSBuild.ExtensionPack.Compression.Zip TaskAction="Create" CompressFiles="@(Files)" ZipFileName="$(WorkingDir)%(Files.Group).zip"/>
  </Target>
</Project>