Versions
PgVersion takes an exact version or a spec that resolves to the newest matching version published for your platform:
csharp
snippet source | anchorvar exact = new PgServer("17.6.0"); // exactly this version
var major = new PgServer("17"); // newest 17.x
var minor = new PgServer("17.6"); // newest 17.6.x
var newest = new PgServer("latest"); // newest of allA spec is resolved when the server starts, and server.PgVersion then holds the exact version:
csharp
snippet source | anchorawait using var server = new PgServer("17");
await server.StartAsync();
Console.WriteLine(server.PgVersion); // the exact version, such as 17.6.0Without network access, a spec falls back to the newest matching version already downloaded. An unknown version fails fast with a clear error.
What is published
csharp
snippet source | anchorIReadOnlyList<string> versions = await PgVersions.GetAvailableAsync(); // for this platform, oldest firstThis reads one small metadata file from the Maven repository. Versions such as 13.1.0-1 are repackaged builds of 13.1.0 and sort after it.
Pin the major for kept data
Postgres cannot open data written by another major version. For a server whose data you keep (a named instance), pin at least the major ("17", not "latest"); the library refuses a mismatch with a clear error before downloading anything.
