DotnetVersionReader 1.0.0
There is a newer version of this package available.
See the version list below for details.
See the version list below for details.
dotnet tool install --global DotnetVersionReader --version 1.0.0
This package contains a .NET tool you can call from the shell/command line.
dotnet new tool-manifest
dotnet tool install --local DotnetVersionReader --version 1.0.0
This package contains a .NET tool you can call from the shell/command line.
#tool dotnet:?package=DotnetVersionReader&version=1.0.0
The NuGet Team does not provide support for this client. Please contact its maintainers for support.
nuke :add-package DotnetVersionReader --version 1.0.0
The NuGet Team does not provide support for this client. Please contact its maintainers for support.
DotnetVersionReader
A .NET global tool for reading version information from .csproj, .sln, and .slnx files.
Installation
dotnet tool install --global DotnetVersionReader
Or from a local build:
dotnet pack src/DotnetVersionReader -c Release
dotnet tool install --global --add-source ./src/DotnetVersionReader/bin/Release DotnetVersionReader
Usage
dotnet-version-reader [<input>] [--output <format>] [--filter <XmlNode=Value>]...
Arguments
| Argument | Description |
|---|---|
<input> |
Path to a .csproj, .sln, .slnx file or a folder. Defaults to the current directory. |
Options
| Option | Short | Description |
|---|---|---|
--output |
-o |
Output format: json (default) or table. |
--filter |
-f |
Filter in the form XmlNode=Value. Value can be a regex. Repeatable. |
Version resolution
The tool follows the same semantics as MSBuild:
- If
<Version>is set, it is used as-is. - Otherwise the version is
<VersionPrefix>(default1.0.0) optionally followed by-<VersionSuffix>.
Examples
# Current directory – JSON output (default)
dotnet-version-reader
# Specific solution file – table output
dotnet-version-reader MySolution.slnx --output table
# Only projects that generate a NuGet package
dotnet-version-reader --filter "GeneratePackageOnBuild=true"
# Combine multiple filters (all must match)
dotnet-version-reader MySolution.slnx --filter "TargetFramework=^net10\\.0$" --filter "GeneratePackageOnBuild=true"
Sample JSON output
[
{
"Name": "MyLibrary",
"Version": "2.1.0-rc.1"
},
{
"Name": "MyApp",
"Version": "1.0.0"
}
]
Sample table output
Name Version
--------- -------
MyLibrary 2.1.0-rc.1
MyApp 1.0.0
Development
# Restore & build
dotnet build DotnetVersionReader.slnx
# Run tests
dotnet test DotnetVersionReader.slnx
# Pack
dotnet pack DotnetVersionReader.slnx -c Release
CI / CD
The repository uses a single GitHub Actions workflow
(.github/workflows/build-test-pack-publish.yml) that runs automatically on
every push to main and can also be triggered manually.
What the workflow does
| Step | Details |
|---|---|
| Restore | dotnet restore against the .slnx solution file |
| Build | dotnet build -c Release (no restore) |
| Test | dotnet test -c Release --no-build |
| Collect metadata | Runs the freshly built DotnetVersionReader.exe with the solution file and -f GeneratePackageOnBuild=true to enumerate all package names + versions |
| Tag commits | Pushes an annotated git tag per package (<Name>-v<Version>) plus one combined release tag |
| Publish to NuGet | Pushes every .nupkg to nuget.org with --skip-duplicate |
| GitHub Release | Creates a GitHub release on the combined tag and uploads all .nupkg files as assets |
Required repository secret
| Secret | Description |
|---|---|
NUGET_API_KEY |
API key from nuget.org with push permission for the package(s) |
Add it under Settings → Secrets and variables → Actions → New repository secret.
Manual dispatch
The workflow can be triggered manually from the Actions tab.
An optional slnx_file input lets you override the solution path
(default: DotnetVersionReader.slnx).
| 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. |
Compatible target framework(s)
Included target framework(s) (in package)
Learn more about Target Frameworks and .NET Standard.
This package has no dependencies.