PowerShell tool to increment version numbers in .rc, .dproj and text source files, supporting WinVer and SemVer styles.
delphi-incver is a PowerShell utility that increments version numbers in
.RC (VERSIONINFO), .dproj (RAD Studio project files) and text source files.
It supports WinVer (numeric N.N.N.N) and SemVer (semver.org) styles.
Designed for use as a standalone command or as a bundled tool inside delphi-powershell-ci.
If delphi-incver is on your PATH:
delphi-incver -File src/versioninfo.rcOtherwise, run it directly:
pwsh -File .\source\delphi-incver.ps1 -File src/versioninfo.rc
# or
powershell.exe -NoProfile -ExecutionPolicy Bypass -File .\source\delphi-incver.ps1 -File src/versioninfo.rcRuns on the widely available Windows PowerShell 5.1 (powershell.exe)
and the newer PowerShell 7+ (pwsh).
- Increment version numbers in RC (VERSIONINFO), DProj, or text source files
- Auto-detect target type from file extension (
.rc-> RC,.dproj-> DProj, else Text) - Auto-detect version style from target (RC/DProj -> WinVer, else SemVer)
- Bump any component:
major,minor,patch,build, orpre-release - Default bump increments the last component of whatever width exists
- Bumping a component zeros everything to its right
- Preserves the original version width (never adds or removes components)
- RC target updates both FileVersion locations in a single pass
- DProj target updates
FileVersionin allVerInfo_Keyselements - Text target uses a user-supplied regex pattern with a capture group
- Structured JSON output via
-OutputFilefor tool integration
Path to the file containing the version to increment. Required.
delphi-incver -File src/versioninfo.rc
delphi-incver -File src/MyApp.dproj
delphi-incver -File source/mytool.ps1 -Pattern '\$script:ToolVersion\s*=\s*''([^'']+)'''File type: RC, DProj, or Text. When omitted, auto-detected from the
file extension.
| Extension | Target |
|---|---|
.rc |
RC |
.dproj |
DProj |
| anything else | Text |
delphi-incver -File version.rc -Target RC
delphi-incver -File MyApp.dproj -Target DProj
delphi-incver -File version.txt -Target Text -Pattern '(\d+\.\d+\.\d+)'Version format: WinVer or SemVer. When omitted, auto-detected from the target.
| Target | Default Style |
|---|---|
| RC | WinVer |
| DProj | WinVer |
| Text | SemVer |
Strictly numeric with 1 to 4 dot-separated components: N, N.N, N.N.N,
or N.N.N.N. Used by Windows VERSIONINFO resources and Delphi project files.
Follows semver.org: MAJOR.MINOR.PATCH with optional
pre-release (-alpha.1) and build metadata (+build.42) suffixes.
| Target | WinVer | SemVer |
|---|---|---|
| RC | Yes (default) | Error |
| DProj | Yes (default) | Error |
| Text | Yes | Yes (default) |
delphi-incver -File ver.rc -Style WinVer
delphi-incver -File ver.txt -Style SemVer -Pattern '(\d+\.\d+\.\d+)'Which version component to increment: major, minor, patch, build,
or pre-release.
When omitted, bumps the last component of the existing version regardless of width:
| Source | Default bump result |
|---|---|
1.0.0.4 |
1.0.0.5 |
9.4.0 |
9.4.1 |
1.3 |
1.4 |
7 |
8 |
When explicit, the source version must have enough parts. For example,
-Part build on a 3-part version is an error.
Bumping a component zeros everything to its right:
1.2.3.4 -Part minor -> 1.3.0.0
1.2.3.4 -Part major -> 2.0.0.0
0.10.0 -Part minor -> 0.11.0
-Part pre-release increments the numeric suffix of the pre-release tag:
1.0.0-alpha.3 -> 1.0.0-alpha.4
1.0.0-beta -> 1.0.0-beta.1
Bumping major, minor, or patch clears the pre-release tag:
1.0.0-alpha.3 -Part patch -> 1.0.1
delphi-incver -File ver.rc -Part minor
delphi-incver -File ver.rc -Part build
delphi-incver -File tool.ps1 -Pattern '...' -Part pre-releaseRegex pattern with a capture group around the version string. Required for Text targets. Not used for RC or DProj targets.
The first capture group identifies the version substring to parse and replace. Everything outside the capture group is preserved as-is.
# PowerShell script version variable
delphi-incver -File tool.ps1 -Pattern '\$script:ToolVersion\s*=\s*''([^'']+)'''
# Generic version in a text file
delphi-incver -File VERSION.txt -Pattern '^(\d+\.\d+\.\d+)$'
# Version in a YAML file
delphi-incver -File pubspec.yaml -Pattern 'version:\s*(\S+)'Patterns containing $ must use single quotes in PowerShell to prevent
variable interpolation. Embed literal single quotes by doubling them ('').
Path to write a structured JSON result file. Used for tool integration
(e.g., by delphi-powershell-ci to capture old/new version strings).
{
"file": "src/versioninfo.rc",
"target": "RC",
"style": "WinVer",
"part": "build",
"oldVersion": "1.2.3.4",
"newVersion": "1.2.3.5"
}delphi-incver -File ver.rc -OutputFile result.jsonFor RC files, delphi-incver updates both FileVersion locations in a
single pass. ProductVersion is left unchanged (it often follows a
different lifecycle).
FILEVERSION 1,2,3,4 -> FILEVERSION 1,2,3,5
PRODUCTVERSION 1,2,3,4 -> (unchanged)
VALUE "FileVersion", "1.2.3.4" -> VALUE "FileVersion", "1.2.3.5"
VALUE "ProductVersion", "1.2.3.4" -> (unchanged)
Supports 1 to 4 part versions. The part count is never changed.
For .dproj files, delphi-incver updates the FileVersion value inside
every VerInfo_Keys element across all PropertyGroup sections. This
follows the same approach as the
Embarcadero blog post
on programmatic .dproj version changes.
- Reads the current version from
FileVersion=in the firstVerInfo_Keys - Increments it using WinVer logic
- Writes the new
FileVersion=to ALLVerInfo_Keysnodes ProductVersionis left unchanged (it often follows a different lifecycle)- Discrete elements (
VerInfo_MajorVer,VerInfo_Build, etc.) are left alone -- the IDE resyncs them when the project is opened
No -Pattern is needed for DProj targets.
delphi-incver -File src/MyApp.dproj
delphi-incver -File src/MyApp.dproj -Part minor 0 = success: version incremented and file updated
1 = unexpected error
2 = invalid arguments (bad target/style combo, missing pattern, etc.)
3 = file not found or unreadable
4 = version pattern not found in file
5 = version increment failed (e.g. explicit -Part build on a 3-part version)
Bump the build number in an RC file (default: last component):
delphi-incver -File src/versioninfo.rcBump the minor version and zero patch/build:
delphi-incver -File src/versioninfo.rc -Part minorBump the FileVersion in a Delphi .dproj file:
delphi-incver -File src/MyApp.dprojBump a SemVer version in a PowerShell script:
delphi-incver -File src/mytool.ps1 -Pattern '\$script:ToolVersion\s*=\s*''([^'']+)'''Bump a pre-release tag:
delphi-incver -File src/mytool.ps1 -Pattern '\$script:ToolVersion\s*=\s*''([^'']+)''' -Part pre-releaseUse WinVer style on a text file:
delphi-incver -File VERSION.txt -Style WinVer -Pattern '^(\d+\.\d+\.\d+\.\d+)$'Requires PowerShell 7+, Pester 5.7+, and PSScriptAnalyzer.
./tests/run-tests.ps1This tool is part of the Continuous-Delphi ecosystem, focused on strengthening Delphi's continued success.

