$npx -y skills add DevExpress/agent-skills --skill devexpress-office-file-api-zipBuild .NET applications with the DevExpress Zip Compression and Archive API for creating, reading, and extracting ZIP archives programmatically. Use when creating zip files, extracting archives, compressing files or streams, adding password protection to archives, compressing byt
| 1 | # DevExpress Zip Compression and Archive API |
| 2 | |
| 3 | The Zip Compression and Archive API is a non-visual .NET library for creating, reading, and extracting ZIP archives programmatically — without any external dependencies. It supports archiving files, directories, streams, byte arrays, and text; password-protecting entries with AES-256 or ZipCrypto; filtering content during archiving; cancellation via progress callbacks; and conflict resolution during extraction. |
| 4 | |
| 5 | ## When to Use This Skill |
| 6 | |
| 7 | Use this skill when you need to: |
| 8 | |
| 9 | - Create a ZIP archive from a directory (recursively) or from a list of files |
| 10 | - Add individual files to a new or existing ZIP archive |
| 11 | - Filter files during archiving using the `ItemAdding` event |
| 12 | - Archive a .NET `Stream` or a `byte[]` directly (without writing to disk first) |
| 13 | - Archive a text string as a named entry in a ZIP file |
| 14 | - Password-protect archive entries using AES-256 (`EncryptionType.Aes256`) or ZipCrypto (`EncryptionType.PkZip`) |
| 15 | - Add comments to individual archive entries |
| 16 | - Extract (unzip) an archive to a directory |
| 17 | - Resolve file conflicts during extraction with a callback (`AllowFileOverwrite` event) |
| 18 | - Cancel a long-running archiving operation via the `Progress` event |
| 19 | - Handle archiving errors without aborting the entire operation |
| 20 | - Add files to an existing archive without losing its current contents |
| 21 | |
| 22 | ## Prerequisites & Installation |
| 23 | |
| 24 | ### NuGet Packages |
| 25 | |
| 26 | | Package | Purpose | |
| 27 | |---------|---------| |
| 28 | | `DevExpress.Document.Processor` | Core ZIP compression and archive functionality | |
| 29 | |
| 30 | ### .NET (8/9/10+) |
| 31 | |
| 32 | ```bash |
| 33 | dotnet add package DevExpress.Document.Processor |
| 34 | ``` |
| 35 | |
| 36 | ### .NET Framework (4.6.2+) |
| 37 | |
| 38 | ``` |
| 39 | Install-Package DevExpress.Document.Processor |
| 40 | ``` |
| 41 | |
| 42 | Or add a reference to `DevExpress.Docs.v26.1.dll` directly. |
| 43 | |
| 44 | **Important**: All DevExpress packages in a project must share the same version number. A valid DevExpress license is required. |
| 45 | |
| 46 | ### Package Versions |
| 47 | |
| 48 | Unless the user explicitly requests a specific version, always target the latest DevExpress release (v26.1 at the time of writing). `dotnet add package <PackageName>` without `--version` installs the latest stable version — prefer this form. Never pin an older version in project files, Dockerfiles, or CI/CD pipelines unless the user asks for it. This is especially important in integration scenarios (Docker, cloud deployments). All `DevExpress.*` packages in a project must share the same version. |
| 49 | |
| 50 | ## Before You Start — Ask the Developer |
| 51 | |
| 52 | If the host agent has a structured question-asking tool available, use it to ask these questions one at a time with clear options — for example, Claude Code's `AskUserQuestion` tool or GitHub Copilot's `askQuestions` tool. If no such tool is available, ask the questions directly in the chat response before generating code. |
| 53 | |
| 54 | Before generating code, ask these questions to avoid rework: |
| 55 | |
| 56 | ### General Questions |
| 57 | 1. **Target framework**: Are you using .NET 8+ or .NET Framework 4.x? |
| 58 | 2. **New or existing project?**: Creating new or adding to existing? |
| 59 | 3. **Hosting model**: Console app, ASP.NET Core, Blazor, MAUI, or something else? |
| 60 | |
| 61 | ### Zip-Specific Questions |
| 62 | 4. **Operation?** Create archive / extract archive / compress stream or byte array / add to existing archive |
| 63 | 5. **Source?** Directory / specific files with filtering / in-memory stream or byte array |
| 64 | 6. **Special requirements?** Password protection / file conflict resolution / cancellation / comments |
| 65 | |
| 66 | > **Rule**: If the developer's answer is ambiguous or missing, ask before generating code. Do not guess. |
| 67 | |
| 68 | ## Component Overview |
| 69 | |
| 70 | The Zip Compression and Archive API provides: |
| 71 | |
| 72 | - **Archive creation**: Create ZIP archives from directories, file lists, streams, byte arrays, or text (`ZipArchive`, `ZipFileItem`, `ZipDirectoryItem`, `ZipStreamItem`, `ZipByteArrayItem`, `ZipTextItem`) |
| 73 | - **Archive reading and extraction**: Open existing ZIP files and extract items to disk (`ZipArchive.Read()`, `ZipItem.Extract()`) |
| 74 | - **Password protection**: Encrypt entries with AES-256 or ZipCrypto (`ZipArchive.Password`, `ZipArchive.EncryptionType`, `EncryptionType`) |
| 75 | - **Event-driven control**: Filter items, track progress, resolve conflicts, handle errors (`ItemAdding`, `Progress`, `AllowFileOverwrite`, `Error` events) |