From 3f1eaeda295f1d416d1064c0fef96e02a2ea550b Mon Sep 17 00:00:00 2001 From: Diogo Trindade Date: Fri, 30 Sep 2022 22:16:02 +0100 Subject: [PATCH] Core - Embed PluginApiVersion into the assembly metadata --- src/Artemis.Core/Artemis.Core.csproj | 5 +++++ src/Artemis.Core/Constants.cs | 4 +++- 2 files changed, 8 insertions(+), 1 deletion(-) diff --git a/src/Artemis.Core/Artemis.Core.csproj b/src/Artemis.Core/Artemis.Core.csproj index a7ec57544..0499f1427 100644 --- a/src/Artemis.Core/Artemis.Core.csproj +++ b/src/Artemis.Core/Artemis.Core.csproj @@ -13,6 +13,11 @@ 1 + + + + + diff --git a/src/Artemis.Core/Constants.cs b/src/Artemis.Core/Constants.cs index e57b947e4..f465f118e 100644 --- a/src/Artemis.Core/Constants.cs +++ b/src/Artemis.Core/Constants.cs @@ -2,6 +2,7 @@ using System; using System.Collections.Generic; using System.Collections.ObjectModel; using System.IO; +using System.Linq; using System.Reflection; using Artemis.Core.JsonConverters; using Artemis.Core.Services; @@ -61,7 +62,8 @@ public static class Constants /// /// The current API version for plugins /// - public static readonly int PluginApiVersion = CoreAssembly.GetName().Version.Major; + public static readonly int PluginApiVersion = int.Parse(CoreAssembly.GetCustomAttributes() + .First(a => a.Key == "PluginApiVersion").Value); /// /// The plugin info used by core components of Artemis