diff --git a/src/Custom.Build.props b/src/Custom.Build.props
index 45ddca79e7..07465268fb 100644
--- a/src/Custom.Build.props
+++ b/src/Custom.Build.props
@@ -13,7 +13,7 @@
10.0.15
- Disable
+ Disable
diff --git a/src/ServiceControlInstaller.Packaging.UnitTests/DeploymentPackageTests.cs b/src/ServiceControlInstaller.Packaging.UnitTests/DeploymentPackageTests.cs
index 9f6f19af1c..9ca885c014 100644
--- a/src/ServiceControlInstaller.Packaging.UnitTests/DeploymentPackageTests.cs
+++ b/src/ServiceControlInstaller.Packaging.UnitTests/DeploymentPackageTests.cs
@@ -1,9 +1,11 @@
namespace Tests
{
+ using System;
using System.Collections.Generic;
using System.Diagnostics;
using System.IO;
using System.Linq;
+ using System.Reflection;
using System.Runtime.InteropServices;
using Microsoft.AspNetCore.Http;
using NUnit.Framework;
@@ -48,6 +50,7 @@ public void DuplicateAssembliesInDeploymentUnitsShouldHaveMatchingVersions()
Assert.That(detectedMismatches, Is.Empty, $"Component assembly version mismatch detected");
}
+ // This test will fail if you are not using the exact runtime version specified in the RuntimeFrameworkVersion property in the Custom.Build.props file
[Test]
public void DuplicateAssembliesFromRuntimeShouldHaveMatchingVersions()
{
@@ -61,9 +64,18 @@ public void DuplicateAssembliesFromRuntimeShouldHaveMatchingVersions()
detectedMismatches.AddRange(GetAssemblyMismatches(deploymentUnit, runtimeDeploymentUnit));
}
- Assert.That(detectedMismatches, Is.Empty, $"Component assembly version mismatch detected");
+ var expectedVersion = typeof(DeploymentPackageTests).Assembly
+ .GetCustomAttributes()
+ .Single(a => a.Key == "RuntimeFrameworkVersion").Value;
+
+ var runtimeMessage = Environment.Version > Version.Parse(expectedVersion)
+ ? $" Runtime rolled forward from requested {expectedVersion} to {Environment.Version}. This test requires the exact runtime version specified in Custom.Build.props."
+ : $" Requested runtime: {expectedVersion}; running runtime: {Environment.Version}.";
+
+ Assert.That(detectedMismatches, Is.Empty, $"Component assembly version mismatch detected.{runtimeMessage}");
}
+ // This test will fail if you are not using the exact runtime version specified in the RuntimeFrameworkVersion property in the Custom.Build.props file
[Test]
public void DuplicateAssembliesFromASPNetCoreShouldHaveMatchingVersions()
{
@@ -77,7 +89,15 @@ public void DuplicateAssembliesFromASPNetCoreShouldHaveMatchingVersions()
detectedMismatches.AddRange(GetAssemblyMismatches(deploymentUnit, aspNetCoreDeploymentUnit));
}
- Assert.That(detectedMismatches, Is.Empty, $"Component assembly version mismatch detected");
+ var expectedVersion = typeof(DeploymentPackageTests).Assembly
+ .GetCustomAttributes()
+ .Single(a => a.Key == "RuntimeFrameworkVersion").Value;
+
+ var runtimeMessage = Version.Parse(aspNetCoreDirectory.Name) > Version.Parse(expectedVersion)
+ ? $" ASP.NET Core runtime rolled forward from requested {expectedVersion} to {aspNetCoreDirectory.Name}. This test requires the exact runtime version specified in Custom.Build.props."
+ : $" Requested ASP.NET Core runtime: {expectedVersion}; running runtime: {aspNetCoreDirectory.Name}.";
+
+ Assert.That(detectedMismatches, Is.Empty, $"Component assembly version mismatch detected.{runtimeMessage}");
}
IEnumerable GetAssemblyMismatches(DeploymentPackage.DeploymentUnit leftDeploymentUnit, DeploymentPackage.DeploymentUnit rightDeploymentUnit)
diff --git a/src/ServiceControlInstaller.Packaging.UnitTests/ServiceControlInstaller.Packaging.UnitTests.csproj b/src/ServiceControlInstaller.Packaging.UnitTests/ServiceControlInstaller.Packaging.UnitTests.csproj
index 38dd4fbc7d..0bee0f8fc8 100644
--- a/src/ServiceControlInstaller.Packaging.UnitTests/ServiceControlInstaller.Packaging.UnitTests.csproj
+++ b/src/ServiceControlInstaller.Packaging.UnitTests/ServiceControlInstaller.Packaging.UnitTests.csproj
@@ -25,4 +25,8 @@
+
+
+
+