|
| 1 | +--- |
| 2 | +Order: 10 |
| 3 | +Title: Migration v6 to v7 |
| 4 | +Description: Migration guidance for upgrading from GitVersion v6 to GitVersion v7. |
| 5 | +--- |
| 6 | + |
| 7 | +This document summarizes the relevant breaking changes when migrating from GitVersion v6 to v7. |
| 8 | + |
| 9 | +## CLI Arguments - POSIX-style syntax |
| 10 | + |
| 11 | +GitVersion now uses POSIX-style command-line arguments powered by System.CommandLine. |
| 12 | + |
| 13 | +:::{.alert .alert-warning} |
| 14 | +**Breaking change:** Legacy Windows-style (`/switch`) and legacy single-dash long-form (`-switch`) arguments are no longer accepted by default. |
| 15 | + |
| 16 | +As a temporary migration aid, set `GITVERSION_USE_V6_ARGUMENT_PARSER=true` to restore legacy argument handling. This compatibility mode is temporary and will be removed in a future release. |
| 17 | +::: |
| 18 | + |
| 19 | +### What you need to change |
| 20 | + |
| 21 | +1. Replace old argument names with POSIX-style `--long-name` arguments. |
| 22 | +2. Prefer `--long-name` arguments for readability and maintainability. Supported short aliases (`-o`, `-v`, `-f`, `-c`, `-l`, `-d`, `-b`, `-u`, `-p`) remain available for interactive use. |
| 23 | +3. Update scripts that used `-c <commit>` to `--commit <commit>`. |
| 24 | +4. Optionally use `GITVERSION_REMOTE_USERNAME` and `GITVERSION_REMOTE_PASSWORD` instead of passing credentials on the command line. |
| 25 | + |
| 26 | +### Full argument mapping |
| 27 | + |
| 28 | +| Old argument | New argument | Short alias | Env var alternative | |
| 29 | +| ----------------------------- | -------------------------------- | ------------------------------ | ---------------------------- | |
| 30 | +| `/targetpath <path>` | `--target-path <path>` | _(positional `path` argument)_ | | |
| 31 | +| `/output <type>` | `--output <type>` | `-o` | | |
| 32 | +| `/outputfile <path>` | `--output-file <path>` | | | |
| 33 | +| `/showvariable <var>` | `--show-variable <var>` | `-v` | | |
| 34 | +| `/format <format>` | `--format <format>` | `-f` | | |
| 35 | +| `/config <path>` | `--config <path>` | `-c` | | |
| 36 | +| `/showconfig` | `--show-config` | | | |
| 37 | +| `/overrideconfig <k=v>` | `--override-config <k=v>` | | | |
| 38 | +| `/nocache` | `--no-cache` | | | |
| 39 | +| `/nofetch` | `--no-fetch` | | | |
| 40 | +| `/nonormalize` | `--no-normalize` | | | |
| 41 | +| `/allowshallow` | `--allow-shallow` | | | |
| 42 | +| `/verbosity <level>` | `--verbosity <level>` | | | |
| 43 | +| `/l <path>` | `--log-file <path>` | `-l` | | |
| 44 | +| `/diag` | `--diagnose` | `-d` | | |
| 45 | +| `/updateassemblyinfo [files]` | `--update-assembly-info [files]` | | | |
| 46 | +| `/updateprojectfiles [files]` | `--update-project-files [files]` | | | |
| 47 | +| `/ensureassemblyinfo` | `--ensure-assembly-info` | | | |
| 48 | +| `/updatewixversionfile` | `--update-wix-version-file` | | | |
| 49 | +| `/url <url>` | `--url <url>` | | | |
| 50 | +| `/b <branch>` | `--branch <branch>` | `-b` | | |
| 51 | +| `/u <username>` | `--username <username>` | `-u` | `GITVERSION_REMOTE_USERNAME` | |
| 52 | +| `/p <password>` | `--password <password>` | `-p` | `GITVERSION_REMOTE_PASSWORD` | |
| 53 | +| `/c <commit>` | `--commit <commit>` | _(no short alias)_ | | |
| 54 | +| `/dynamicRepoLocation <path>` | `--dynamic-repo-location <path>` | | | |
| 55 | + |
| 56 | +:::{.alert .alert-danger} |
| 57 | +**Important:** `-c` now maps to `--config`. |
| 58 | + |
| 59 | +If you previously used `-c <commit-id>`, you must replace it with `--commit <commit-id>`. |
| 60 | +::: |
| 61 | + |
| 62 | +### Example updates |
| 63 | + |
| 64 | +```bash |
| 65 | +# Before |
| 66 | +gitversion /output json /showvariable SemVer /config GitVersion.yml |
| 67 | + |
| 68 | +# After |
| 69 | +gitversion --output json --show-variable SemVer --config GitVersion.yml |
| 70 | +``` |
| 71 | + |
| 72 | +```bash |
| 73 | +# Before |
| 74 | +gitversion /url https://github.com/org/repo.git /b main /u user /p pass /c a1b2c3 |
| 75 | + |
| 76 | +# After |
| 77 | +gitversion --url https://github.com/org/repo.git --branch main --username user --password pass --commit a1b2c3 |
| 78 | +``` |
| 79 | + |
| 80 | +For current command details and examples, see [CLI Arguments](/docs/usage/cli/arguments). |
0 commit comments