Skip to content

Commit 7e89e27

Browse files
committed
Better way to check version
Checks to see if the dotnet 6 or greater is running.
1 parent e4deba2 commit 7e89e27

File tree

1 file changed

+6
-1
lines changed

1 file changed

+6
-1
lines changed

ElectronNET.CLI/Commands/Actions/GetTargetPlatformInformation.cs

Lines changed: 6 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -103,6 +103,7 @@ public static GetTargetPlatformInformationResult Do(string desiredPlatform, stri
103103
private static bool Dotnet6Installed()
104104
{
105105
//check for .net 6:
106+
//execute dotnet --list-sdks to get versions
106107
Process process = new Process();
107108
process.StartInfo.FileName = "dotnet";
108109
process.StartInfo.Arguments = "--list-sdks";
@@ -113,9 +114,13 @@ private static bool Dotnet6Installed()
113114

114115
string standard_output;
115116
bool dotnet6Exists = false;
117+
118+
//get command output:
116119
while ((standard_output = process.StandardOutput.ReadLine()) != null)
117120
{
118-
if (standard_output.StartsWith("6."))
121+
//get the major version and see if its greater than or equal to 6
122+
int majorVer = int.Parse(standard_output.Split(".")[0]);
123+
if (majorVer >= 6)
119124
{
120125
dotnet6Exists = true;
121126
break;

0 commit comments

Comments
 (0)