Better way to check version

Checks to see if the dotnet 6 or greater is running.
This commit is contained in:
Brendan McShane
2021-12-06 20:28:57 -05:00
parent e4deba2489
commit 7e89e27c26

View File

@@ -103,6 +103,7 @@ namespace ElectronNET.CLI.Commands.Actions
private static bool Dotnet6Installed()
{
//check for .net 6:
//execute dotnet --list-sdks to get versions
Process process = new Process();
process.StartInfo.FileName = "dotnet";
process.StartInfo.Arguments = "--list-sdks";
@@ -113,9 +114,13 @@ namespace ElectronNET.CLI.Commands.Actions
string standard_output;
bool dotnet6Exists = false;
//get command output:
while ((standard_output = process.StandardOutput.ReadLine()) != null)
{
if (standard_output.StartsWith("6."))
//get the major version and see if its greater than or equal to 6
int majorVer = int.Parse(standard_output.Split(".")[0]);
if (majorVer >= 6)
{
dotnet6Exists = true;
break;