@@ -77,24 +77,27 @@ public async Task<List<IStep>> InitializeJob(IExecutionContext jobContext, Pipel
77
77
78
78
PackageVersion agentVersion = new PackageVersion ( BuildConstants . AgentPackage . Version ) ;
79
79
80
- // Check if a system supports .NET 8
81
- try
80
+ if ( ! AgentKnobs . Net8UnsupportedOsWarning . GetValue ( context ) . AsBoolean ( ) )
82
81
{
83
- Trace . Verbose ( "Checking if your system supports .NET 8" ) ;
82
+ // Check if a system supports .NET 8
83
+ try
84
+ {
85
+ Trace . Verbose ( "Checking if your system supports .NET 8" ) ;
84
86
85
- // Check version of the system
86
- if ( ! await PlatformUtil . IsNetVersionSupported ( "net8" ) )
87
+ // Check version of the system
88
+ if ( ! await PlatformUtil . IsNetVersionSupported ( "net8" ) )
89
+ {
90
+ string systemId = PlatformUtil . GetSystemId ( ) ;
91
+ SystemVersion systemVersion = PlatformUtil . GetSystemVersion ( ) ;
92
+ context . Warning ( StringUtil . Loc ( "UnsupportedOsVersionByNet8" , $ "{ systemId } { systemVersion } ") ) ;
93
+ }
94
+ }
95
+ catch ( Exception ex )
87
96
{
88
- string systemId = PlatformUtil . GetSystemId ( ) ;
89
- SystemVersion systemVersion = PlatformUtil . GetSystemVersion ( ) ;
90
- context . Warning ( StringUtil . Loc ( "UnsupportedOsVersionByNet8" , $ "{ systemId } { systemVersion } ") ) ;
97
+ Trace . Error ( $ "Error has occurred while checking if system supports .NET 8: { ex } ") ;
98
+ context . Warning ( ex . Message ) ;
91
99
}
92
100
}
93
- catch ( Exception ex )
94
- {
95
- Trace . Error ( $ "Error has occurred while checking if system supports .NET 8: { ex } ") ;
96
- context . Warning ( ex . Message ) ;
97
- }
98
101
99
102
// Set agent version variable.
100
103
context . SetVariable ( Constants . Variables . Agent . Version , BuildConstants . AgentPackage . Version ) ;
0 commit comments