Valid TaskActions are:

AddFile (Required: NewFile, CabFile, CabExePath, ExtractExePath, NewFileDestination)

Create (Required: PathToCab or FilesToCab, CabFile, ExePath. Optional: PreservePaths, StripPrefixes, Recursive)

Extract (Required: CabFile, ExtractExePath, ExtractTo Optional: ExtractFile)

Compatible with:

Microsoft (R) Cabinet Tool (cabarc.exe) - Version 5.2.3790.0

Microsoft (R) CAB File Extract Utility (extrac32.exe)- Version 5.2.3790.0

Remote Execution Support: No

Namespace: MSBuild.ExtensionPack.Compression
Assembly: MSBuild.ExtensionPack (in MSBuild.ExtensionPack.dll) Version: 3.5.0.0

Examples

Xml Copy imageCopy
<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">
        <ItemGroup>
            <!-- Create a collection of files to CAB -->
            <Files Include="C:\ddd\**\*"/>
        </ItemGroup>
        <!-- Create the CAB using the File collection and preserve the paths whilst stripping a prefix -->
        <MSBuild.ExtensionPack.Compression.Cab TaskAction="Create" FilesToCab="@(Files)" CabExePath="D:\BuildTools\CabArc.Exe" CabFile="C:\newcabbyitem.cab" PreservePaths="true" StripPrefixes="ddd\"/>
        <!-- Create the same CAB but this time based on the Path. Note that Recursive is required -->
        <MSBuild.ExtensionPack.Compression.Cab TaskAction="Create" PathToCab="C:\ddd" CabExePath="D:\BuildTools\CabArc.Exe" CabFile="C:\newcabbypath.cab" PreservePaths="true" StripPrefixes="ddd\" Recursive="true"/>
        <!-- Add a file to the CAB -->
        <MSBuild.ExtensionPack.Compression.Cab TaskAction="AddFile" NewFile="c:\New Text Document.txt" CabExePath="D:\BuildTools\CabArc.Exe" ExtractExePath="D:\BuildTools\Extrac32.EXE" CabFile="C:\newcabbyitem.cab" NewFileDestination="\Any Path"/>
        <!-- Extract a CAB-->
        <MSBuild.ExtensionPack.Compression.Cab TaskAction="Extract" ExtractTo="c:\a111" ExtractExePath="D:\BuildTools\Extrac32.EXE" CabFile="C:\newcabbyitem.cab"/>
    </Target>
</Project>

Inheritance Hierarchy

System..::..Object
  Microsoft.Build.Utilities..::..Task
    MSBuild.ExtensionPack..::..BaseTask
      MSBuild.ExtensionPack.Compression..::..Cab

See Also