using System; using System.Reflection; namespace StellaOps.Feedser.Exporter.Json; public static class ExporterVersion { public static string GetVersion(Type anchor) { ArgumentNullException.ThrowIfNull(anchor); var assembly = anchor.Assembly; var informational = assembly.GetCustomAttribute()?.InformationalVersion; if (!string.IsNullOrWhiteSpace(informational)) { return informational; } var fileVersion = assembly.GetCustomAttribute()?.Version; if (!string.IsNullOrWhiteSpace(fileVersion)) { return fileVersion!; } var version = assembly.GetName().Version; return version?.ToString() ?? "0.0.0"; } }