Add app version logging on startup (#31)

This commit is contained in:
Marius Nechifor
2025-01-01 17:09:06 +02:00
committed by GitHub
parent 8f024f8c7b
commit f905b17b3a
2 changed files with 12 additions and 0 deletions

View File

@@ -1,3 +1,4 @@
using System.Reflection;
using Executable.DependencyInjection;
var builder = Host.CreateApplicationBuilder(args);
@@ -7,4 +8,14 @@ builder.Logging.AddLogging(builder.Configuration);
var host = builder.Build();
var logger = host.Services.GetRequiredService<ILogger<Program>>();
var version = Assembly.GetExecutingAssembly().GetName().Version;
logger.LogInformation(
version is null
? "cleanuperr version not detected"
: $"cleanuperr v{version.Major}.{version.Minor}.{version.Build}"
);
host.Run();