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
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
Name | Description | |
---|---|---|
Cab |
Properties
Name | Description | |
---|---|---|
CabExePath |
Sets the path to CabArc.Exe
| |
CabFile |
Sets the CAB file. Required.
| |
ExtractExePath |
Sets the path to extrac32.exe
| |
ExtractFile |
Sets the files to extract. Default is /E, which is all.
| |
ExtractTo |
Sets the path to extract to
| |
FilesToCab |
Sets the files to cab
| |
NewFile |
Sets the new file to add to the Cab File
| |
NewFileDestination |
Sets the path to add the file to
| |
PathToCab |
Sets the path to cab
| |
PreservePaths |
Sets a value indicating whether [preserve paths]
| |
Recursive |
Sets whether to add files and folders recursively if PathToCab is specified.
| |
StripPrefixes |
Sets the prefixes to strip. Delimit with ';'
|
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