diff --git a/src/libraries/System.Runtime.InteropServices.RuntimeInformation/tests/DescriptionNameTests.cs b/src/libraries/System.Runtime.InteropServices.RuntimeInformation/tests/DescriptionNameTests.cs
index 81f979679d802..94f006c5f587c 100644
--- a/src/libraries/System.Runtime.InteropServices.RuntimeInformation/tests/DescriptionNameTests.cs
+++ b/src/libraries/System.Runtime.InteropServices.RuntimeInformation/tests/DescriptionNameTests.cs
@@ -180,6 +180,29 @@ public void VerifyRuntimeNameOnNetCoreApp()
Assert.Same(RuntimeInformation.FrameworkDescription, RuntimeInformation.FrameworkDescription);
}
+ [Fact]
+ public void VerifyFrameworkDescriptionContainsCorrectVersion()
+ {
+ var frameworkDescription = RuntimeInformation.FrameworkDescription;
+ var version = frameworkDescription.Substring(".NET".Length).Trim(); // remove ".NET" prefix
+
+ if (string.IsNullOrEmpty(version))
+ return;
+
+ Assert.DoesNotContain("+", version); // no git hash
+
+#if STABILIZE_PACKAGE_VERSION
+ // a stabilized version looks like 8.0.0
+ Assert.DoesNotContain("-", version);
+ Assert.True(Version.TryParse(version, out Version _));
+#else
+ // a non-stabilized version looks like 8.0.0-preview.5.23280.8 or 8.0.0-dev
+ Assert.Contains("-", version);
+ var versionNumber = version.Substring(0, version.IndexOf("-"));
+ Assert.True(Version.TryParse(versionNumber, out Version _));
+#endif
+ }
+
[Fact]
public void VerifyOSDescription()
{
diff --git a/src/libraries/System.Runtime.InteropServices.RuntimeInformation/tests/System.Runtime.InteropServices.RuntimeInformation.Tests.csproj b/src/libraries/System.Runtime.InteropServices.RuntimeInformation/tests/System.Runtime.InteropServices.RuntimeInformation.Tests.csproj
index 72355db6c397d..94daeb2079a35 100644
--- a/src/libraries/System.Runtime.InteropServices.RuntimeInformation/tests/System.Runtime.InteropServices.RuntimeInformation.Tests.csproj
+++ b/src/libraries/System.Runtime.InteropServices.RuntimeInformation/tests/System.Runtime.InteropServices.RuntimeInformation.Tests.csproj
@@ -4,6 +4,9 @@
true
$(NetCoreAppCurrent)-windows;$(NetCoreAppCurrent)-unix;$(NetCoreAppCurrent)-browser
+
+ $(DefineConstants);STABILIZE_PACKAGE_VERSION
+