diff options
| author | ruki <[email protected]> | 2026-03-17 22:43:06 +0800 |
|---|---|---|
| committer | GitHub <[email protected]> | 2026-03-17 22:43:06 +0800 |
| commit | 42dec9486bb56c2f08db0c30f6b2829e1b02a1a7 (patch) | |
| tree | 7fcea3a58a9b9b0495747c255a209a81dae4bc86 /tests/projects/csharp/console_with_runtime_json/src/Program.cs | |
| parent | 1c5607aa0da666cd244af2cab5fc7280e30742f1 (diff) | |
| parent | 2134b93d3f87d8f4ea63e0c49b2075ba056995d9 (diff) | |
Merge pull request #7398 from xmake-io/csharp
Add csharp support
Diffstat (limited to 'tests/projects/csharp/console_with_runtime_json/src/Program.cs')
| -rw-r--r-- | tests/projects/csharp/console_with_runtime_json/src/Program.cs | 15 |
1 files changed, 15 insertions, 0 deletions
diff --git a/tests/projects/csharp/console_with_runtime_json/src/Program.cs b/tests/projects/csharp/console_with_runtime_json/src/Program.cs new file mode 100644 index 000000000..fd836a339 --- /dev/null +++ b/tests/projects/csharp/console_with_runtime_json/src/Program.cs @@ -0,0 +1,15 @@ +using System.Text.Json; + +var runtimeFile = Path.Combine(Directory.GetCurrentDirectory(), "runtime.json"); +if (!File.Exists(runtimeFile)) { + Console.WriteLine("runtime.json missing"); + return; +} + +var json = File.ReadAllText(runtimeFile); +using var doc = JsonDocument.Parse(json); +var runtime = doc.RootElement.TryGetProperty("runtime", out var value) + ? value.GetString() + : "unknown"; + +Console.WriteLine($"runtime={runtime}"); |
