diff --git a/BepInEx.Core/Contract/Attributes.cs b/BepInEx.Core/Contract/Attributes.cs
index f570058a..25ccf6bd 100644
--- a/BepInEx.Core/Contract/Attributes.cs
+++ b/BepInEx.Core/Contract/Attributes.cs
@@ -2,8 +2,8 @@
using System.Collections.Generic;
using System.IO;
using System.Linq;
+using System.Reflection;
using BepInEx.Bootstrap;
-using BepInEx.Core;
using Mono.Cecil;
namespace BepInEx
@@ -269,6 +269,17 @@ public static BepInPlugin GetMetadata(object plugin)
return (T[])pluginType.GetCustomAttributes(typeof(T), true);
}
+ ///
+ /// Gets the specified attributes of an assembly, if they exist.
+ ///
+ /// The assembly.
+ /// The attribute type to retrieve.
+ /// The attributes of the type, if existing.
+ public static T[] GetAttributes(Assembly assembly) where T : Attribute
+ {
+ return (T[])assembly.GetCustomAttributes(typeof(T), true);
+ }
+
///
/// Gets the specified attributes of an instance, if they exist.
///
diff --git a/BepInEx.Core/Paths.cs b/BepInEx.Core/Paths.cs
index 2cfb53ee..06f35780 100644
--- a/BepInEx.Core/Paths.cs
+++ b/BepInEx.Core/Paths.cs
@@ -1,5 +1,4 @@
using System.IO;
-using System.Linq;
using System.Reflection;
using MonoMod.Utils;
@@ -34,7 +33,7 @@ internal static void SetPluginPath(string pluginPath)
PluginPath = Utility.CombinePaths(BepInExRootPath, pluginPath);
}
- public static SemVer.Version BepInExVersion { get; } = SemVer.Version.Parse(typeof(Paths).Assembly.GetCustomAttributes(typeof(AssemblyInformationalVersionAttribute), false).Cast().First().InformationalVersion);
+ public static SemVer.Version BepInExVersion { get; } = SemVer.Version.Parse(MetadataHelper.GetAttributes(typeof(Paths).Assembly)[0].InformationalVersion);
///
/// The directory that the core BepInEx DLLs reside in.