summaryrefslogtreecommitdiff
path: root/tests/projects/csharp/shared_library
diff options
context:
space:
mode:
authorruki <[email protected]>2026-03-17 22:43:06 +0800
committerGitHub <[email protected]>2026-03-17 22:43:06 +0800
commit42dec9486bb56c2f08db0c30f6b2829e1b02a1a7 (patch)
tree7fcea3a58a9b9b0495747c255a209a81dae4bc86 /tests/projects/csharp/shared_library
parent1c5607aa0da666cd244af2cab5fc7280e30742f1 (diff)
parent2134b93d3f87d8f4ea63e0c49b2075ba056995d9 (diff)
Merge pull request #7398 from xmake-io/csharp
Add csharp support
Diffstat (limited to 'tests/projects/csharp/shared_library')
-rw-r--r--tests/projects/csharp/shared_library/.gitignore6
-rw-r--r--tests/projects/csharp/shared_library/src/app/Program.cs4
-rw-r--r--tests/projects/csharp/shared_library/src/lib/Greeter.cs7
-rw-r--r--tests/projects/csharp/shared_library/test.lua13
-rw-r--r--tests/projects/csharp/shared_library/xmake.lua12
5 files changed, 42 insertions, 0 deletions
diff --git a/tests/projects/csharp/shared_library/.gitignore b/tests/projects/csharp/shared_library/.gitignore
new file mode 100644
index 000000000..6b8d3af38
--- /dev/null
+++ b/tests/projects/csharp/shared_library/.gitignore
@@ -0,0 +1,6 @@
+.xmake/
+build/
+bin/
+obj/
+vsxmake*/
+.vs/
diff --git a/tests/projects/csharp/shared_library/src/app/Program.cs b/tests/projects/csharp/shared_library/src/app/Program.cs
new file mode 100644
index 000000000..3cf7cb84a
--- /dev/null
+++ b/tests/projects/csharp/shared_library/src/app/Program.cs
@@ -0,0 +1,4 @@
+using MyLib;
+
+Console.WriteLine(Greeter.Greet("xmake"));
+
diff --git a/tests/projects/csharp/shared_library/src/lib/Greeter.cs b/tests/projects/csharp/shared_library/src/lib/Greeter.cs
new file mode 100644
index 000000000..cf895138a
--- /dev/null
+++ b/tests/projects/csharp/shared_library/src/lib/Greeter.cs
@@ -0,0 +1,7 @@
+namespace MyLib;
+
+public static class Greeter {
+ public static string Greet(string name) {
+ return $"hello {name}!";
+ }
+}
diff --git a/tests/projects/csharp/shared_library/test.lua b/tests/projects/csharp/shared_library/test.lua
new file mode 100644
index 000000000..d909316b7
--- /dev/null
+++ b/tests/projects/csharp/shared_library/test.lua
@@ -0,0 +1,13 @@
+import("detect.sdks.find_dotnet")
+
+function test_build(t)
+ if is_subhost("msys") then
+ return t:skip("csharp not supported on msys")
+ end
+ local dotnet = find_dotnet()
+ if dotnet and dotnet.sdkver then
+ t:build()
+ else
+ return t:skip("dotnet sdk not found")
+ end
+end
diff --git a/tests/projects/csharp/shared_library/xmake.lua b/tests/projects/csharp/shared_library/xmake.lua
new file mode 100644
index 000000000..f8549444e
--- /dev/null
+++ b/tests/projects/csharp/shared_library/xmake.lua
@@ -0,0 +1,12 @@
+add_rules("mode.debug", "mode.release")
+
+target("mylib")
+ set_kind("shared")
+ add_rules("csharp")
+ add_files("src/lib/*.cs")
+
+target("app")
+ set_kind("binary")
+ add_rules("csharp")
+ add_deps("mylib")
+ add_files("src/app/*.cs")