![Copy image Copy image](copycode.gif)
![CopyHover image CopyHover image](copycodeHighlight.gif)
Deployment Tools Foundation
Pack Method (sourceDirectory, includeSubdirectories, compLevel, progressHandler)
Deployment Tools Foundation Namespaces ► Microsoft.Deployment.Compression ► ArchiveInfo ► Pack(String, Boolean, CompressionLevel, EventHandler<(Of <<'(ArchiveProgressEventArgs>)>>))
Compresses all files in a directory into the archive, optionally
including subdirectories.
![](collapse_all.gif)
C# | Visual Basic | Visual C++ | F# |
public void Pack( string sourceDirectory, bool includeSubdirectories, CompressionLevel compLevel, EventHandler<ArchiveProgressEventArgs> progressHandler )
Public Sub Pack ( sourceDirectory As String, includeSubdirectories As Boolean, compLevel As CompressionLevel, progressHandler As EventHandler(Of ArchiveProgressEventArgs) )
public: void Pack( String^ sourceDirectory, bool includeSubdirectories, CompressionLevel compLevel, EventHandler<ArchiveProgressEventArgs^>^ progressHandler )
member Pack : sourceDirectory : string * includeSubdirectories : bool * compLevel : CompressionLevel * progressHandler : EventHandler<ArchiveProgressEventArgs> -> unit
![](collapse_all.gif)
- sourceDirectory (String)
- This is the root directory for to pack all files.
- includeSubdirectories (Boolean)
- If true, recursively include files in subdirectories.
- compLevel (CompressionLevel)
- The compression level used when creating the archive.
- progressHandler (EventHandler<(Of <(<'ArchiveProgressEventArgs>)>)>)
- Handler for receiving progress information; this may be null if progress is not desired.
![](collapse_all.gif)
The files are stored in the archive using their relative file paths in
the directory tree, if supported by the archive file format.
Assembly: Microsoft.Deployment.Compression (Module: Microsoft.Deployment.Compression.dll) Version: 3.0.0.0 (3.11.1.2318)