Skip to content

Commit 79a6827

Browse files
committed
CLI:
- #429: CS-Script fails to run after installing .NET 10 / VS 2026: System.Diagnostics.StackTrace, Version=10.0.0.0 not found
1 parent 25928f3 commit 79a6827

File tree

2 files changed

+21
-7
lines changed

2 files changed

+21
-7
lines changed

src/out/static_content/-self/-rt/-run.cs

Lines changed: 21 additions & 7 deletions
Original file line numberDiff line numberDiff line change
@@ -1,14 +1,14 @@
11
//css_engine csc
22
//css_include global-usings
3-
using csscript;
43
using System;
4+
using static System.Console;
55
using System.Diagnostics;
6+
using static System.Environment;
67
using System.Linq;
8+
using static System.Reflection.Assembly;
79
using System.Text.Json;
810
using System.Text.Json.Nodes;
9-
using static System.Console;
10-
using static System.Environment;
11-
using static System.Reflection.Assembly;
11+
using csscript;
1212

1313
var arg1 = args.FirstOrDefault();
1414

@@ -20,13 +20,15 @@
2020

2121
WriteLine($@"v{version} ({Environment.GetEnvironmentVariable("EntryScript")})");
2222
WriteLine($"Sets the script engine target runtime to one of the available .NET deployments.");
23-
WriteLine($" css -self-rt [-help] ");
23+
WriteLine($" css -self-rt [-l] [-help] ");
24+
WriteLine($" -l - set the latest available version of runtime.");
25+
WriteLine($" -help - print this help information.");
2426
return;
2527
}
2628

2729
// ===============================================
2830

29-
Console.WriteLine("Available .NET runtimes:");
31+
WriteLine("Available .NET runtimes:");
3032

3133
var sdk_list = "dotnet".run("--list-runtimes") // Microsoft.NETCore.App 9.0.4 [C:\Program Files\dotnet\shared\Microsoft.NETCore.App]
3234
.Split(NewLine)
@@ -42,9 +44,21 @@
4244
WriteLine($"{line.Index}: {line.Version}");
4345
}
4446

47+
var selectLatest = args.Contains("-l");
48+
4549
WriteLine();
4650
Write("Enter the index of the desired target runtime version: ");
47-
var input = ReadLine();
51+
var input = "";
52+
53+
if (selectLatest)
54+
{
55+
input = sdk_list.Count().ToString();
56+
Write(input);
57+
}
58+
else
59+
{
60+
input = ReadLine();
61+
}
4862

4963
if (int.TryParse(input, out int index))
5064
{

0 commit comments

Comments
 (0)