[backend] Add codename to assembly metadata

This commit is contained in:
Laura Hausmann 2024-05-24 22:41:43 +02:00
parent 46d5fdc1af
commit 9eb5710e84
No known key found for this signature in database
GPG key ID: D044E84C5BE01605
2 changed files with 19 additions and 5 deletions

View file

@ -16,13 +16,23 @@ public sealed class Config
public sealed class InstanceSection
{
public readonly string Version;
public readonly string Codename;
public InstanceSection()
{
// Get version information from assembly
var version = Assembly.GetEntryAssembly()!
var attributes = Assembly.GetEntryAssembly()!
.GetCustomAttributes()
.OfType<AssemblyInformationalVersionAttribute>()
.ToList();
// Get codename from assembly
Codename = attributes
.OfType<AssemblyMetadataAttribute>()
.FirstOrDefault(p => p.Key == "codename")
?.Value ??
"unknown";
// Get version information from assembly
var version = attributes.OfType<AssemblyInformationalVersionAttribute>()
.First()
.InformationalVersion;

View file

@ -13,6 +13,10 @@
<GarbageCollectionAdaptationMode>1</GarbageCollectionAdaptationMode>
</PropertyGroup>
<ItemGroup>
<AssemblyMetadata Include="codename" Value="alpha" />
</ItemGroup>
<PropertyGroup Condition=" '$(Configuration)' == 'Release' ">
<BlazorWebAssemblyOmitDebugProxyOutput>true</BlazorWebAssemblyOmitDebugProxyOutput>
<PreserveCompilationContext>false</PreserveCompilationContext>