summaryrefslogtreecommitdiff
path: root/tests/projects/csharp/console_with_runtime_json/src
diff options
context:
space:
mode:
authorJassJam <[email protected]>2026-02-23 12:28:50 +0000
committerruki <[email protected]>2026-03-14 00:08:40 +0800
commit9946d1814f4af9ef67e5accd9404e0fc69290f6f (patch)
treef669ea003ab4947aabb7732696aefa4e62f5793c /tests/projects/csharp/console_with_runtime_json/src
parent95fa1f158a4044b9851ce6c0f4ff21f3427ce83e (diff)
feat: add initial test files
Diffstat (limited to 'tests/projects/csharp/console_with_runtime_json/src')
-rw-r--r--tests/projects/csharp/console_with_runtime_json/src/Program.cs17
-rw-r--r--tests/projects/csharp/console_with_runtime_json/src/app.csproj14
-rw-r--r--tests/projects/csharp/console_with_runtime_json/src/runtime.json7
3 files changed, 38 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}");
+
diff --git a/tests/projects/csharp/console_with_runtime_json/src/app.csproj b/tests/projects/csharp/console_with_runtime_json/src/app.csproj
new file mode 100644
index 000000000..4e754bb15
--- /dev/null
+++ b/tests/projects/csharp/console_with_runtime_json/src/app.csproj
@@ -0,0 +1,14 @@
+<Project Sdk="Microsoft.NET.Sdk">
+ <PropertyGroup>
+ <OutputType>Exe</OutputType>
+ <TargetFramework>net8.0</TargetFramework>
+ <ImplicitUsings>enable</ImplicitUsings>
+ <Nullable>enable</Nullable>
+ </PropertyGroup>
+ <ItemGroup>
+ <None Include="runtime.json">
+ <CopyToOutputDirectory>PreserveNewest</CopyToOutputDirectory>
+ </None>
+ </ItemGroup>
+</Project>
+
diff --git a/tests/projects/csharp/console_with_runtime_json/src/runtime.json b/tests/projects/csharp/console_with_runtime_json/src/runtime.json
new file mode 100644
index 000000000..15bec810d
--- /dev/null
+++ b/tests/projects/csharp/console_with_runtime_json/src/runtime.json
@@ -0,0 +1,7 @@
+{
+ "runtime": "xmake",
+ "featureFlags": {
+ "sample": true
+ }
+}
+