Fixed: Removed .Net update notice on Windows LTSB 2015

This commit is contained in:
Taloth Saldono 2019-08-30 20:39:34 +02:00
parent 6d232778e2
commit 354ddcfee5
2 changed files with 21 additions and 1 deletions

View File

@ -53,5 +53,17 @@ namespace NzbDrone.Core.Test.HealthCheck.Checks
Subject.Check().ShouldBeError();
}
[Test]
public void should_return_ok_for_net462_on_Win1511()
{
Mocker.GetMock<IOsInfo>()
.SetupGet(v => v.Version)
.Returns("10.0.14392");
GivenOutput("4.6.2");
Subject.Check().ShouldBeOk();
}
}
}

View File

@ -7,11 +7,13 @@ namespace NzbDrone.Core.HealthCheck.Checks
public class DotnetVersionCheck : HealthCheckBase
{
private readonly IPlatformInfo _platformInfo;
private readonly IOsInfo _osInfo;
private readonly Logger _logger;
public DotnetVersionCheck(IPlatformInfo platformInfo, Logger logger)
public DotnetVersionCheck(IPlatformInfo platformInfo, IOsInfo osInfo, Logger logger)
{
_platformInfo = platformInfo;
_osInfo = osInfo;
_logger = logger;
}
@ -26,6 +28,12 @@ namespace NzbDrone.Core.HealthCheck.Checks
// Target .Net version, which would allow us to increase our target framework
var targetVersion = new Version("4.7.2");
if (Version.TryParse(_osInfo.Version, out var osVersion) && osVersion < new Version("10.0.14393"))
{
// Windows 10 LTSB 1511 and before do not support 4.7.x
targetVersion = new Version("4.6.2");
}
if (dotnetVersion >= targetVersion)
{
_logger.Debug("Dotnet version is {0} or better: {1}", targetVersion, dotnetVersion);