Table of Contents

Class OptunaSharpVersion

Namespace
OptunaSharp
Assembly
OptunaSharp.dll

Version metadata for OptunaSharp — the .NET port of Optuna. This mirrors Optuna's optuna/version.py (version): the package version and the Optuna release this port tracks as its behavioral source of truth.

public static class OptunaSharpVersion
Inheritance
OptunaSharpVersion
Inherited Members

Fields

OptunaCompatibilityTarget

The Optuna release this port tracks as its behavioral source of truth, written as Optuna's own optuna.version (refs/optuna is pinned at v5.0.0).

public const string OptunaCompatibilityTarget = "5.0.0"

Field Value

string

Remarks

The SQLite and EF Core storages print it where Optuna prints version.version: "The runtime optuna version 5.0.0 is no longer compatible with the table schema ...". It read "5.0" until 2026-11-12, which made that message differ from Optuna's (QA-75 of the 2026-11-10 parity QA run).

Version

The version of the OptunaSharp assembly that is actually loaded, i.e. the NuGet package version (1.2.3, 1.2.3-rc.1) without its +commit build metadata. It is the analogue of Python's optuna.version.

public static readonly string Version

Field Value

string

Remarks

Read once, at first use, from the assembly's AssemblyInformationalVersionAttribute. The build stamps that attribute from the MSBuild Version property, which the release pipeline sets from the pushed v* tag. So this value cannot drift from the package version the way a hand-maintained literal does.

It is deliberately a static readonly field, not a const. The compiler copies a const into every consumer at the consumer's own compile time. An application built against one OptunaSharp and run against another would then report the old number, and so would every database the SQLite and EF Core storages create: they record "OptunaSharp " + Version in version_info.library_version. The trade-off is that the value cannot appear in attribute arguments, switch labels or other constant expressions.

The fallbacks matter only for hand-rolled builds that disable the generated attribute (GenerateAssemblyInformationalVersionAttribute=false). The value then falls back to the numeric assembly version, and finally to "0.0.0", so it is never null.