zipsrc 3.1.0

dotnet tool install --global zipsrc --version 3.1.0
                    
This package contains a .NET tool you can call from the shell/command line.
dotnet new tool-manifest
                    
if you are setting up this repo
dotnet tool install --local zipsrc --version 3.1.0
                    
This package contains a .NET tool you can call from the shell/command line.
#tool dotnet:?package=zipsrc&version=3.1.0
                    
nuke :add-package zipsrc --version 3.1.0
                    

"dnx zipsrc" command

NuGet Package unit tests Discord

Overview

"dnx zipsrc" is a .NET global tool that creates a zip archive from source files in your project, using .gitignore patterns to exclude artifacts, dependencies, and other non-source files.

System Requirements

.NET SDK Version 10.0 or later is required.

Usage

dnx zipsrc [options]
Option Description
-d, --directory <directory> Specifies the target directory to archive. Default is the current directory.
-n, --name <file> Specifies the output zip file path. If not specified, the default name is determined automatically. See Output file naming for details.
-l, --loglevel {detailed|normal|quiet} Specifies the log level for console output. Default is normal.
-v, --version Displays the version number of the tool.
-h, --help Displays usage information and available options.

What gets zipped

  • Recursively scans the specified directory (including subdirectories) and collects files to zip.
  • Focuses on source code and other development-relevant files. Typical non-source artifacts are excluded (e.g., bin/, obj/ for .NET projects, node_modules/ for Node.js, and other build outputs, caches, or downloaded dependencies).

Default exclusions

The following files and folders are always excluded by default:

  • Version control directories: .git/, .svn/, .hg/
  • Zip archives: *.zip

Additionally, on Windows, files and folders with the Hidden attribute are excluded by default.

You can explicitly include any of these default-excluded items by using negation patterns in your .gitignore file (e.g., !.git/).

How ignore rules are applied

  • Ignore rules are based on .gitignore patterns.
    • If the target directory contains a .gitignore, its rules are honored.
    • If there is no .gitignore at the target directory, the tool falls back to the default rules equivalent to those from dotnet new gitignore.
    • .gitignore files in subdirectories are also read and respected. Negation patterns (e.g., !pattern) are correctly handled.
  • .git/info/exclude files are also supported.
    • If a .git/info/exclude file exists in a directory, its rules are applied after .gitignore, allowing them to override .gitignore patterns.

Output file naming

  • When -n|--name is specified:
    • If the provided name does not end with .zip, the .zip extension is automatically appended.
  • When -n|--name is not specified, the output file name is decided as follows:
    1. If a .sln or .slnx file exists in the target directory, the base name of that solution file plus .zip is used.
    2. Otherwise, the target directory name plus .zip is used.
  • If a file with the chosen name already exists, a numeric suffix like (2), (3), ... is appended to create a new non-conflicting name.

Examples

  • Zip the current directory using defaults:
    dnx zipsrc
    
  • Zip a specific directory:
    dnx zipsrc -d ./src/MyApp
    
  • Specify an explicit output name (extension auto-appended if missing):
    dnx zipsrc -d ./src/MyApp -n ./artifacts/MyAppSource
    # => produces ./artifacts/MyAppSource.zip
    

Release Notes

See the Releases

License

Product Compatible and additional computed target framework versions.
.NET net10.0 is compatible.  net10.0-android was computed.  net10.0-browser was computed.  net10.0-ios was computed.  net10.0-maccatalyst was computed.  net10.0-macos was computed.  net10.0-tvos was computed.  net10.0-windows was computed. 
Compatible target framework(s)
Included target framework(s) (in package)
Learn more about Target Frameworks and .NET Standard.

This package has no dependencies.

Version Downloads Last Updated
3.1.0 197 1/23/2026
3.0.0 144 1/21/2026
2.0.0 130 1/20/2026
1.0.0 151 1/7/2026

v.3.1.0
- Add support for .git/info/exclude files as an additional ignore source.
- Add console output to display file names being processed.
- Add --help, --version, and --loglevel options to the CLI.


To see all the change logs, please visit the following URL.
- https://github.com/jsakamoto/dnx-zipsrc/blob/main/RELEASE-NOTES.txt