zipsrc 3.1.0
dotnet tool install --global zipsrc --version 3.1.0
dotnet new tool-manifest
dotnet tool install --local zipsrc --version 3.1.0
#tool dotnet:?package=zipsrc&version=3.1.0
nuke :add-package zipsrc --version 3.1.0
"dnx zipsrc" command
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
.gitignorepatterns.- If the target directory contains a
.gitignore, its rules are honored. - If there is no
.gitignoreat the target directory, the tool falls back to the default rules equivalent to those fromdotnet new gitignore. .gitignorefiles in subdirectories are also read and respected. Negation patterns (e.g.,!pattern) are correctly handled.
- If the target directory contains a
.git/info/excludefiles are also supported.- If a
.git/info/excludefile exists in a directory, its rules are applied after.gitignore, allowing them to override.gitignorepatterns.
- If a
Output file naming
- When
-n|--nameis specified:- If the provided name does not end with
.zip, the.zipextension is automatically appended.
- If the provided name does not end with
- When
-n|--nameis not specified, the output file name is decided as follows:- If a
.slnor.slnxfile exists in the target directory, the base name of that solution file plus.zipis used. - Otherwise, the target directory name plus
.zipis used.
- If a
- 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
- Mozilla Public License 2.0
- Third Party Notices is here
| Product | Versions 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. |
This package has no dependencies.
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