Cab Class

MSBuild Extension Pack

Cab Class MSBuild Extension Pack Help 4.0.12.0
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

SystemObject  Microsoft.Build.UtilitiesTask
    MSBuild.ExtensionPackBaseTask
      MSBuild.ExtensionPack.CompressionCab

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

The Cab type exposes the following members.

Constructors

  NameDescription
Public methodCab
Top
Properties

  NameDescription
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 ';'
Top
Examples

<Project ToolsVersion="4.0" 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>
See Also

Reference