# C# Rules ## Rules
## Overview 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. ## Setup Add the following to your `WORKSPACE` file to add the external repositories: ```python load("@bazel_tools//tools/build_defs/dotnet:csharp.bzl", "csharp_repositories") csharp_repositories() ``` ## Examples ### csharp_library ```python csharp_library( name = "MyLib", srcs = ["MyLib.cs"], deps = ["//my/dependency:SomeLib"], ) ``` ### csharp_binary ```python csharp_binary( name = "MyApp", main = "MyApp", # optional name of the main class. srcs = ["MyApp.cs"], deps = ["//my/dependency:MyLib"], ) ``` ### csharp\_nunit\_test ```python csharp_nunit_test( name = "MyApp", srcs = ["MyApp.cs"], deps = ["//my/dependency:MyLib"], ) ``` ## Things still missing: - Handle .resx files correctly. - .Net Modules - Conditionally building documentation. - Pulling Mono in through a mono.WORKSPACE file. ## Future nice to haves: - Building csproj and sln files for VS and MonoDevelop. - Nuget Packaging - Windows .NET framwork support ## csharp_library ```python csharp_library(name, srcs, deps, warn=4, csc) ``` Builds a C# .NET library and its corresponding documentation.Attributes | |
---|---|
name |
Unique name for this rule |
srcs |
Csharp .cs or .resx files. |
deps |
Dependencies for this rule. |
warn |
Compiler warn level for this library. (Defaults to 4.) |
csc |
Override the default csharp compiler. Note: This attribute may removed in future versions. |
Attributes | |
---|---|
name |
Unique name for this rule |
srcs |
Csharp .cs or .resx files. |
deps |
Dependencies for this rule. |
main_class |
Name of class with |
warn |
Compiler warn level for this binary. (Defaults to 4.) |
csc |
Override the default csharp compiler. Note: This attribute may removed in future versions. |
Attributes | |
---|---|
name |
Unique name for this rule |
srcs |
Csharp .cs or .resx files. |
deps |
Dependencies for this rule. |
warn |
Compiler warn level for this test. (Defaults to 4.) |
csc |
Override the default csharp compiler. Note: This attribute may removed in future versions. |