This is a minimal viable set of C# bindings for building csharp code with mono. It's still pretty rough but it works as a proof of concept that could grow into something more. If windows support ever happens for Bazel then this might become especially valuable.
Add the following to your WORKSPACE
file to add the external repositories:
load("@bazel_tools//tools/build_defs/dotnet:csharp.bzl", "csharp_repositories") csharp_repositories()
csharp_library( name = "MyLib", srcs = ["MyLib.cs"], deps = ["//my/dependency:SomeLib"], )
csharp_binary( name = "MyApp", main = "MyApp", # optional name of the main class. srcs = ["MyApp.cs"], deps = ["//my/dependency:MyLib"], )
csharp_nunit_test( name = "MyApp", srcs = ["MyApp.cs"], deps = ["//my/dependency:MyLib"], )
csharp_library(name, srcs, deps, warn=4, csc)
Builds a C# .NET library and its corresponding documentation.
csharp_binary(name, srcs, deps, main_class, warn=4, csc)
Builds a C# .NET binary.
csharp_nunit_test(name, srcs, deps, warn=4, csc)
Builds a C# .NET test binary that uses the NUnit unit testing framework.