File tree Expand file tree Collapse file tree 1 file changed +6
-10
lines changed
test/DotnetAffected.Tasks.Tests Expand file tree Collapse file tree 1 file changed +6
-10
lines changed Original file line number Diff line number Diff line change @@ -14,24 +14,20 @@ public static class Utils
1414
1515 private static readonly Lazy < string > TargetFrameworkLocal = new ( ( ) =>
1616 {
17- var targetFramework = typeof ( Utils ) . Assembly
17+ var targetFrameworkAttribute = typeof ( Utils ) . Assembly
1818 . GetCustomAttributes ( typeof ( System . Runtime . Versioning . TargetFrameworkAttribute ) , false )
1919 . OfType < System . Runtime . Versioning . TargetFrameworkAttribute > ( )
20- . Single ( )
21- . FrameworkName ;
22-
23- var majorVersion = new Regex ( ".+,Version=v(\\ d).(\\ d)" )
24- . Match ( targetFramework )
25- . Groups . Values . Skip ( 1 )
26- . Select ( g => int . Parse ( g . Value ) )
27- . First ( ) ;
20+ . Single ( ) ;
21+
22+ var frameworkName = new System . Runtime . Versioning . FrameworkName ( targetFrameworkAttribute . FrameworkName ) ;
23+ var majorVersion = frameworkName . Version . Major ;
2824
2925 switch ( majorVersion )
3026 {
3127 case >= 5 :
3228 return $ "net{ majorVersion } .0";
3329 default :
34- throw new NotSupportedException ( $ "Invalid TargetFramework: { targetFramework } ") ;
30+ throw new NotSupportedException ( $ "Invalid TargetFramework: { frameworkName } ") ;
3531 }
3632 } ) ;
3733 }
You can’t perform that action at this time.
0 commit comments