APIReference.md
October 27, 2020 ยท View on GitHub
csharp_binary
csharp_binary(name, additionalfiles, analyzers, defines, deps, include_stdrefs, keyfile, langversion, out, resources, runtimeconfig_template, srcs, target_frameworks, winexe)
Compile a C# exe
ATTRIBUTES
| Name | Description | Type | Mandatory | Default |
|---|---|---|---|---|
| name | A unique name for this target. | Name | required | |
| additionalfiles | Extra files to configure analyzers. | List of labels | optional | [] |
| analyzers | A list of analyzer references. | List of labels | optional | [] |
| defines | A list of preprocessor directive symbols to define. | List of strings | optional | [] |
| deps | Other C# libraries, binaries, or imported DLLs | List of labels | optional | [] |
| include_stdrefs | Whether to reference @net//:StandardReferences (the default set of references that MSBuild adds to every project). | Boolean | optional | True |
| keyfile | The key file used to sign the assembly with a strong name. | Label | optional | None |
| langversion | The version string for the C# language. | String | optional | "" |
| out | File name, without extension, of the built assembly. | String | optional | "" |
| resources | A list of files to embed in the DLL as resources. | List of labels | optional | [] |
| runtimeconfig_template | A template file to use for generating runtimeconfig.json | Label | optional | :runtimeconfig.json.tpl |
| srcs | C# source files. | List of labels | optional | [] |
| target_frameworks | A list of target framework monikers to buildSee https://docs.microsoft.com/en-us/dotnet/standard/frameworks | List of strings | optional | [] |
| winexe | If true, output a winexe-style executable, otherwiseoutput a console-style executable. | Boolean | optional | False |
csharp_library
csharp_library(name, additionalfiles, analyzers, defines, deps, include_stdrefs, keyfile, langversion, out, resources, srcs, target_frameworks)
Compile a C# DLL
ATTRIBUTES
| Name | Description | Type | Mandatory | Default |
|---|---|---|---|---|
| name | A unique name for this target. | Name | required | |
| additionalfiles | Extra files to configure analyzers. | List of labels | optional | [] |
| analyzers | A list of analyzer references. | List of labels | optional | [] |
| defines | A list of preprocessor directive symbols to define. | List of strings | optional | [] |
| deps | Other C# libraries, binaries, or imported DLLs | List of labels | optional | [] |
| include_stdrefs | Whether to reference @net//:StandardReferences (the default set of references that MSBuild adds to every project). | Boolean | optional | True |
| keyfile | The key file used to sign the assembly with a strong name. | Label | optional | None |
| langversion | The version string for the C# language. | String | optional | "" |
| out | File name, without extension, of the built assembly. | String | optional | "" |
| resources | A list of files to embed in the DLL as resources. | List of labels | optional | [] |
| srcs | C# source files. | List of labels | optional | [] |
| target_frameworks | A list of target framework monikers to buildSee https://docs.microsoft.com/en-us/dotnet/standard/frameworks | List of strings | optional | [] |
csharp_library_set
csharp_library_set(name, deps, target_framework)
Defines a set of C# libraries to be depended on together
ATTRIBUTES
| Name | Description | Type | Mandatory | Default |
|---|---|---|---|---|
| name | A unique name for this target. | Name | required | |
| deps | The set of libraries | List of labels | optional | [] |
| target_framework | The target framework for this set of libraries | String | required |
csharp_nunit_test
csharp_nunit_test(name, additionalfiles, analyzers, defines, deps, include_stdrefs, keyfile, langversion, out, resources, srcs, target_frameworks)
Compile a C# exe
ATTRIBUTES
| Name | Description | Type | Mandatory | Default |
|---|---|---|---|---|
| name | A unique name for this target. | Name | required | |
| additionalfiles | Extra files to configure analyzers. | List of labels | optional | [] |
| analyzers | A list of analyzer references. | List of labels | optional | [] |
| defines | A list of preprocessor directive symbols to define. | List of strings | optional | [] |
| deps | Other C# libraries, binaries, or imported DLLs | List of labels | optional | [] |
| include_stdrefs | Whether to reference @net//:StandardReferences (the default set of references that MSBuild adds to every project). | Boolean | optional | True |
| keyfile | The key file used to sign the assembly with a strong name. | Label | optional | None |
| langversion | The version string for the C# language. | String | optional | "" |
| out | File name, without extension, of the built assembly. | String | optional | "" |
| resources | A list of files to embed in the DLL as resources. | List of labels | optional | [] |
| srcs | C# source files. | List of labels | optional | [] |
| target_frameworks | A list of target framework monikers to buildSee https://docs.microsoft.com/en-us/dotnet/standard/frameworks | List of strings | optional | [] |
import_library
import_library(name, deps, dll, native_dlls, pdb, refdll, target_framework)
Creates a target for a static C# DLL for a specific target framework
ATTRIBUTES
| Name | Description | Type | Mandatory | Default |
|---|---|---|---|---|
| name | A unique name for this target. | Name | required | |
| deps | other DLLs that this DLL depends on. | List of labels | optional | [] |
| dll | A static DLL | Label | optional | None |
| native_dlls | A list of native dlls, which while unreferenced, are required for running and compiling | List of labels | optional | [] |
| pdb | Debug symbols for the dll | Label | optional | None |
| refdll | A metadata-only DLL, suitable for compiling against but not running | Label | optional | None |
| target_framework | The target framework for this DLL | String | required |
import_multiframework_library
import_multiframework_library(name, net11, net20, net30, net35, net40, net403, net45, net451, net452, net46, net461, net462, net47, net471, net472, net48, netcoreapp1_0, netcoreapp1_1, netcoreapp2_0, netcoreapp2_1, netcoreapp2_2, netcoreapp3_0, netcoreapp3_1, netstandard, netstandard1_0, netstandard1_1, netstandard1_2, netstandard1_3, netstandard1_4, netstandard1_5, netstandard1_6, netstandard2_0, netstandard2_1)
Aggregate import_library targets for specific target-frameworks into one target
ATTRIBUTES
| Name | Description | Type | Mandatory | Default |
|---|---|---|---|---|
| name | A unique name for this target. | Name | required | |
| net11 | The net11 version of this library | Label | optional | None |
| net20 | The net20 version of this library | Label | optional | None |
| net30 | The net30 version of this library | Label | optional | None |
| net35 | The net35 version of this library | Label | optional | None |
| net40 | The net40 version of this library | Label | optional | None |
| net403 | The net403 version of this library | Label | optional | None |
| net45 | The net45 version of this library | Label | optional | None |
| net451 | The net451 version of this library | Label | optional | None |
| net452 | The net452 version of this library | Label | optional | None |
| net46 | The net46 version of this library | Label | optional | None |
| net461 | The net461 version of this library | Label | optional | None |
| net462 | The net462 version of this library | Label | optional | None |
| net47 | The net47 version of this library | Label | optional | None |
| net471 | The net471 version of this library | Label | optional | None |
| net472 | The net472 version of this library | Label | optional | None |
| net48 | The net48 version of this library | Label | optional | None |
| netcoreapp1_0 | The netcoreapp1.0 version of this library | Label | optional | None |
| netcoreapp1_1 | The netcoreapp1.1 version of this library | Label | optional | None |
| netcoreapp2_0 | The netcoreapp2.0 version of this library | Label | optional | None |
| netcoreapp2_1 | The netcoreapp2.1 version of this library | Label | optional | None |
| netcoreapp2_2 | The netcoreapp2.2 version of this library | Label | optional | None |
| netcoreapp3_0 | The netcoreapp3.0 version of this library | Label | optional | None |
| netcoreapp3_1 | The netcoreapp3.1 version of this library | Label | optional | None |
| netstandard | The netstandard version of this library | Label | optional | None |
| netstandard1_0 | The netstandard1.0 version of this library | Label | optional | None |
| netstandard1_1 | The netstandard1.1 version of this library | Label | optional | None |
| netstandard1_2 | The netstandard1.2 version of this library | Label | optional | None |
| netstandard1_3 | The netstandard1.3 version of this library | Label | optional | None |
| netstandard1_4 | The netstandard1.4 version of this library | Label | optional | None |
| netstandard1_5 | The netstandard1.5 version of this library | Label | optional | None |
| netstandard1_6 | The netstandard1.6 version of this library | Label | optional | None |
| netstandard2_0 | The netstandard2.0 version of this library | Label | optional | None |
| netstandard2_1 | The netstandard2.1 version of this library | Label | optional | None |
csharp_register_toolchains
csharp_register_toolchains()
PARAMETERS
csharp_repositories
csharp_repositories()
Download dependencies of csharp rules.
PARAMETERS
import_nuget_package
import_nuget_package(name, dir, file, build_file, build_file_content, sha256)
Import a vendored NuGet package from either a directory or .nupkg file.
Rather than downloading the package over HTTP from a package source, an extracted package directory or a .nupkg file can be used. These may be checked into your repository within your workspace, or somewhere else on your disk.
Exactly one of either the dir or file arguments must be provided. They can either be a relative path in the workspace, or an absolute path. Note that paths on Windows use forward slashes.
At most one of build_file or build_file_content may be provided. If neither are, a default BUILD file will be used that makes a "best effort" to wire up the package. See docs/UsingNuGetPacakges.md for more info.
PARAMETERS
| Name | Description | Default Value |
|---|---|---|
| name | A unique name for the package's workspace. | none |
| dir | A directory containing an extracted package. | None |
| file | A path to a nupkg file | None |
| build_file | The path to a BUILD file to use for the package. | None |
| build_file_content | A string containing the contents of a BUILD file. | None |
| sha256 | The SHA256 of the package. This is only used when importing nupkg files. You may or may not find it useful, but it will silence a DEBUG message from Bazel regarding reproducibility. | None |
nuget_package
nuget_package(name, package, version, nuget_sources, sha256, build_file, build_file_content)
Download an external NuGet package.
At most one of build_file or build_file_content may be provided. If neither are, a default BUILD file will be used that makes a "best effort" to wire up the package. See docs/UsingNuGetPacakges.md for more info.
PARAMETERS
| Name | Description | Default Value |
|---|---|---|
| name | A unique name for the package's workspace. | none |
| package | The name of the package in the NuGet feed. | none |
| version | The version of the package in the NuGet feed. | none |
| nuget_sources | A list of nuget package sources. Defaults to nuget.org. | None |
| sha256 | The SHA256 of the package. | None |
| build_file | The path to a BUILD file to use for the package. | None |
| build_file_content | A string containing the contents of a BUILD file. | None |