Cab ClassMSBuild Extension Pack Help
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

Inheritance Hierarchy


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

The Cab type exposes the following members.


Public methodCab

Public propertyCabExePath
Sets the path to CabArc.Exe
Public propertyCabFile
Sets the CAB file. Required.
Public propertyExtractExePath
Sets the path to extrac32.exe
Public propertyExtractFile
Sets the files to extract. Default is /E, which is all.
Public propertyExtractTo
Sets the path to extract to
Public propertyFilesToCab
Sets the files to cab
Public propertyNewFile
Sets the new file to add to the Cab File
Public propertyNewFileDestination
Sets the path to add the file to
Public propertyPathToCab
Sets the path to cab
Public propertyPreservePaths
Sets a value indicating whether [preserve paths]
Public propertyRecursive
Sets whether to add files and folders recursively if PathToCab is specified.
Public propertyStripPrefixes
Sets the prefixes to strip. Delimit with ';'

<Project ToolsVersion="4.0" DefaultTargets="Default" xmlns="">
        <TPath Condition="Exists('$(MSBuildProjectDirectory)\..\..\Common\MSBuild.ExtensionPack.tasks')">$(MSBuildProjectDirectory)\..\..\Common\MSBuild.ExtensionPack.tasks</TPath>
    <Import Project="$(TPath)"/>
    <Target Name="Default">
            <!-- Create a collection of files to CAB -->
            <Files Include="C:\ddd\**\*"/>
        <!-- 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:\" 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:\" 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:\" NewFileDestination="\Any Path"/>
        <!-- Extract a CAB-->
        <MSBuild.ExtensionPack.Compression.Cab TaskAction="Extract" ExtractTo="c:\a111" ExtractExePath="D:\BuildTools\Extrac32.EXE" CabFile="C:\"/>
See Also