Skip to content

Commit 9fc4887

Browse files
Update src/JD.Efcpt.Build.Tasks/Utilities/DotNetToolUtilities.cs
Co-authored-by: Copilot <175728472+Copilot@users.noreply.github.com>
1 parent ea795a0 commit 9fc4887

1 file changed

Lines changed: 25 additions & 2 deletions

File tree

src/JD.Efcpt.Build.Tasks/Utilities/DotNetToolUtilities.cs

Lines changed: 25 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -102,8 +102,31 @@ public static bool IsDnxAvailable(string dotnetExe)
102102
return false;
103103
}
104104

105-
// If we can list runtimes and .NET 10 SDK is installed, dnx is available
106-
return process.ExitCode == 0 && IsDotNet10SdkInstalled(dotnetExe);
105+
if (process.ExitCode != 0)
106+
{
107+
return false;
108+
}
109+
110+
// If we can list runtimes and at least one .NET 10 runtime is present, dnx is available
111+
foreach (var line in output.Split(new[] { '\n' }, StringSplitOptions.RemoveEmptyEntries))
112+
{
113+
var trimmed = line.Trim();
114+
if (string.IsNullOrEmpty(trimmed))
115+
continue;
116+
117+
// Expected format: "<runtimeName> <version> [path]"
118+
var parts = trimmed.Split(new[] { ' ' }, StringSplitOptions.RemoveEmptyEntries);
119+
if (parts.Length < 2)
120+
continue;
121+
122+
var versionStr = parts[1];
123+
if (Version.TryParse(versionStr, out var version) && version.Major >= 10)
124+
{
125+
return true;
126+
}
127+
}
128+
129+
return false;
107130
}
108131
catch
109132
{

0 commit comments

Comments
 (0)