-
-
Notifications
You must be signed in to change notification settings - Fork 60
/
Copy pathMinVerCli.cs
20 lines (17 loc) · 979 Bytes
/
MinVerCli.cs
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
namespace MinVerTests.Infra;
public static class MinVerCli
{
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)
{
var environmentVariables = envVars.ToDictionary(envVar => envVar.Item1, envVar => envVar.Item2, StringComparer.OrdinalIgnoreCase);
_ = environmentVariables.TryAdd("MinVerVerbosity".ToAltCase(), "trace");
return CommandEx.ReadLoggedAsync("dotnet", $"exec {GetPath(configuration)} {args}", workingDirectory, environmentVariables, handleExitCode);
}
public static string GetPath(string configuration) =>
#if NET8_0
Solution.GetFullPath($"minver-cli/bin/{configuration}/net8.0/minver-cli.dll");
#endif
#if NET9_0
Solution.GetFullPath($"minver-cli/bin/{configuration}/net9.0/minver-cli.dll");
#endif
}