diff --git a/src/Jackett.Common/Jackett.Common.csproj b/src/Jackett.Common/Jackett.Common.csproj
index 2326ea392..14b9df5a7 100644
--- a/src/Jackett.Common/Jackett.Common.csproj
+++ b/src/Jackett.Common/Jackett.Common.csproj
@@ -211,4 +211,11 @@
+
+
+
+ <_Parameter1>$([System.DateTime]::UtcNow.ToString("yyyyMMddHHmmss"))
+
+
+
diff --git a/src/Jackett.Common/Utils/BuildDate.cs b/src/Jackett.Common/Utils/BuildDate.cs
new file mode 100644
index 000000000..8e96915a0
--- /dev/null
+++ b/src/Jackett.Common/Utils/BuildDate.cs
@@ -0,0 +1,27 @@
+using System;
+using System.Globalization;
+using System.Reflection;
+
+namespace Jackett.Common.Utils
+{
+ public static class BuildDate
+ {
+ public static DateTime GetBuildDateTime()
+ {
+ Assembly commonAssembly = Assembly.GetExecutingAssembly();
+ var attribute = commonAssembly.GetCustomAttribute();
+ return attribute?.DateTime ?? default(DateTime);
+ }
+ }
+
+ [AttributeUsage(AttributeTargets.Assembly)]
+ public class BuildDateAttribute : Attribute
+ {
+ public BuildDateAttribute(string value)
+ {
+ DateTime = DateTime.ParseExact(value, "yyyyMMddHHmmss", CultureInfo.InvariantCulture, DateTimeStyles.AssumeUniversal);
+ }
+
+ public DateTime DateTime { get; }
+ }
+}
diff --git a/src/Jackett.Server/Services/ServerService.cs b/src/Jackett.Server/Services/ServerService.cs
index 1c3c695bc..def47e2ab 100644
--- a/src/Jackett.Server/Services/ServerService.cs
+++ b/src/Jackett.Server/Services/ServerService.cs
@@ -261,20 +261,14 @@ namespace Jackett.Server.Services
//Warn user that they are using an old version of Jackett
try
{
- string appFolder = configService.ApplicationFolder();
- string dllPath = Path.Combine(appFolder, "Jackett.Common.dll");
+ DateTime compiledData = BuildDate.GetBuildDateTime();
- if (File.Exists(dllPath))
+ if (compiledData < DateTime.Now.AddMonths(-3))
{
- DateTime creation = File.GetCreationTime(dllPath);
-
- if (creation < DateTime.Now.AddMonths(-3))
- {
- string version = configService.GetVersion();
- string notice = $"Your version of Jackett v{version} is very old. Multiple indexers are likely to fail when using an old version. Update to the latest version of Jackett.";
- _notices.Add(notice);
- logger.Error(notice);
- }
+ string version = configService.GetVersion();
+ string notice = $"Your version of Jackett v{version} is very old. Multiple indexers are likely to fail when using an old version. Update to the latest version of Jackett.";
+ _notices.Add(notice);
+ logger.Error(notice);
}
}
catch (Exception e)