csharp_library()
This is liable to change in the future.
A csharp_library() rule builds a .Net library from the supplied set of C# source files and dependencies by invoking csc.
Arguments
name
(required) #The short name for this build target.
dll_name
(defaults toThe name of the target appended with .dll
) #The output name of the dll. This allows you to specify the name of the dll exactly. When this is not set, the dll will be named after the short name of the target.
srcs
(required) #The collection of source files to compile.
resources
(required) #Resources that should be embedded within the built DLL. The format is the name of the resource once mapped into the DLL as the key, and the value being the resource that should be merged. This allows non-unique keys to be identified quickly.
framework_ver
(required) #The version of the .Net framework that this library targets. This is one of 'net35', 'net40', 'net45' and 'net46'.
deps
(defaults to[]
) #The set of targets or system-provided assemblies to rely on. Any values that are targets must be either csharp_library or
prebuilt_dotnet_library
instances.compiler_flags
(defaults to[]
) #The set of additional compiler flags to pass to the compiler.
visibility
(defaults to[]
) #List of build target patterns that identify the build rules that can include this rule as a dependency, for example, by listing it in their
deps
orexported_deps
attributes. For more information, see visibility.licenses
(defaults to[]
) #Set of license files for this library. To get the list of license files for a given build rule and all of its dependencies, you can use
buck query
.labels
(defaults to[]
) #Set of arbitrary strings which allow you to annotate a build rule with tags that can be searched for over an entire dependency tree using
buck query attrfilter()
.
Examples
For more examples, check out our integration tests.
csharp_library( name = 'simple', dll_name = 'Cake.dll', framework_ver = 'net46', srcs = [ 'Hello.cs', ], resources = { 'greeting.txt': '//some:target', }, deps=[ ':other', 'System.dll', ], ) prebuilt_dotnet_library( name = 'other', assembly = 'other-1.0.dll', )