@@ -2,19 +2,24 @@ namespace MinVerTests.Infra;
22
33public static class MinVerCli
44{
5- public static Task < ( string StandardOutput , string StandardError ) > ReadAsync ( string workingDirectory , string configuration = Configuration . Current , string args = "" , Func < int , bool > ? handleExitCode = null , params ( string , string ) [ ] envVars )
5+ public static async Task < ( string StandardOutput , string StandardError ) > ReadAsync ( string workingDirectory , string configuration = Configuration . Current , string args = "" , Func < int , bool > ? handleExitCode = null , params ( string , string ) [ ] envVars )
66 {
77 var environmentVariables = envVars . ToDictionary ( envVar => envVar . Item1 , envVar => envVar . Item2 , StringComparer . OrdinalIgnoreCase ) ;
88 _ = environmentVariables . TryAdd ( "MinVerVerbosity" . ToAltCase ( ) , "trace" ) ;
99
10- return CommandEx . ReadLoggedAsync ( "dotnet" , $ "exec { GetPath ( configuration ) } { args } ", workingDirectory , environmentVariables , handleExitCode ) ;
10+ var path = await GetPath ( configuration ) . ConfigureAwait ( false ) ;
11+ return await CommandEx . ReadLoggedAsync ( "dotnet" , $ "exec { path } { args } ", workingDirectory , environmentVariables , handleExitCode ) . ConfigureAwait ( false ) ;
1112 }
1213
13- public static string GetPath ( string configuration ) =>
14- #if NET8_0
15- Solution . GetFullPath ( $ "minver-cli/bin/{ configuration } /net8.0/minver-cli.dll") ;
16- #endif
17- #if NET9_0
18- Solution . GetFullPath ( $"minver-cli/bin/{configuration}/net9.0/minver-cli.dll" ) ;
19- #endif
14+ public static async Task < string > GetPath ( string configuration )
15+ {
16+ var targetFramework = await GetTargetFramework ( ) . ConfigureAwait ( false ) ;
17+ return Solution . GetFullPath ( $ "minver-cli/bin/{ configuration } /{ targetFramework } /minver-cli.dll") ;
18+ }
19+
20+ private static async Task < string > GetTargetFramework ( )
21+ {
22+ var sdkVersionInUse = await Sdk . GetVersionInUse ( ) . ConfigureAwait ( false ) ;
23+ return sdkVersionInUse . Split ( '.' , 2 ) [ 0 ] == "8" ? "net8.0" : "net9.0" ;
24+ }
2025}
0 commit comments