diff options
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 | 17 |
1 files changed, 17 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..2c9b0783b --- /dev/null +++ b/tests/projects/csharp/console_with_runtime_json/src/Program.cs @@ -0,0 +1,17 @@ +using System.Text.Json; + +var runtimeFile = Path.Combine(AppContext.BaseDirectory, "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}"); + |
