File tree Expand file tree Collapse file tree 3 files changed +35
-4
lines changed
tests/Microsoft.DotNet.Framework.Docker.Tests Expand file tree Collapse file tree 3 files changed +35
-4
lines changed Original file line number Diff line number Diff line change @@ -20,18 +20,30 @@ public static class Config
2020 Environment . GetEnvironmentVariable ( "DOCKERFILE_PATHS" ) ?
2121 . Split ( ',' , StringSplitOptions . RemoveEmptyEntries ) ?? Array . Empty < string > ( ) ;
2222
23+ #nullable enable
24+ private static JObject ? _manifestVariables = null ;
25+ public static JObject ManifestVariables
26+ {
27+ get
28+ {
29+ _manifestVariables ??= GetManifestVariables ( ) ;
30+ return _manifestVariables ;
31+ }
32+ }
33+ #nullable disable
34+
2335 public static string GetManifestRegistry ( )
2436 {
2537 string manifestJson = File . ReadAllText ( "manifest.json" ) ;
2638 JObject manifest = JObject . Parse ( manifestJson ) ;
2739 return ( string ) manifest [ "registry" ] ;
2840 }
2941
30- public static Version GetManifestVsVersion ( )
42+ private static JObject GetManifestVariables ( )
3143 {
3244 string manifestJson = File . ReadAllText ( "manifest.versions.json" ) ;
3345 JObject manifest = JObject . Parse ( manifestJson ) ;
34- return System . Version . Parse ( ( string ) ( manifest [ "variables" ] [ "vs|version" ] ) ) ;
46+ return ( JObject ) manifest [ "variables" ] ;
3547 }
3648
3749 public static string GetFilterRegexPattern ( string filter )
Original file line number Diff line number Diff line change 22// The .NET Foundation licenses this file to you under the MIT license.
33// See the LICENSE file in the project root for more information.
44
5+ using System ;
6+ using Newtonsoft . Json . Linq ;
7+
58namespace Microsoft . DotNet . Framework . Docker . Tests ;
69
710internal static class ImageDescriptorExtensions
@@ -13,6 +16,23 @@ internal static class ImageDescriptorExtensions
1316 public static string GetDockerfilePath ( this ImageDescriptor imageDescriptor , string imageType ) =>
1417 $ "src/{ imageType } /{ imageDescriptor . Version } /{ imageDescriptor . OsVariant } ";
1518
19+ /// <summary>
20+ /// The expected Visual Studio version installed inside the image.
21+ /// </summary>
22+ public static Version GetExpectedVsVersion ( this ImageDescriptor imageDescriptor )
23+ {
24+ JObject manifestVariables = Config . ManifestVariables ;
25+ string vsVersionVariable = imageDescriptor . OsVariant switch
26+ {
27+ // Visual Studio 2026/dev18 does not support Windows Server 2016.
28+ // See https://learn.microsoft.com/visualstudio/releases/2026/compatibility
29+ OsVersion . WSC_LTSC2016 => "vs|ltsc2016|version" ,
30+ _ => "vs|version" ,
31+ } ;
32+
33+ return Version . Parse ( ( string ) manifestVariables [ vsVersionVariable ] ) ;
34+ }
35+
1636 /// <summary>
1737 /// The expected Visual Studio installation path inside the image.
1838 /// </summary>
Original file line number Diff line number Diff line change @@ -112,8 +112,7 @@ public void VerifyVsWhereOperability(ImageDescriptor imageDescriptor)
112112 // Get build version instead of a display version or semantic version because it's easier to parse and can
113113 // also seamlessly work with preview versions.
114114 Version actualVsVersion = Version . Parse ( json [ 0 ] [ "catalog" ] [ "buildVersion" ] . ToString ( ) ) ;
115-
116- Version expectedVsVersion = Config . GetManifestVsVersion ( ) ;
115+ Version expectedVsVersion = imageDescriptor . GetExpectedVsVersion ( ) ;
117116
118117 Assert . Equal ( expectedVsVersion . Major , actualVsVersion . Major ) ;
119118 Assert . Equal ( expectedVsVersion . Minor , actualVsVersion . Minor ) ;
You can’t perform that action at this time.
0 commit comments