Skip to content
Henrik edited this page Aug 21, 2014 · 1 revision

Run the C# compiler directly, to compile your code and build your projects.

desc "Manually compile this project"
csc :build do |cmd|
  cmd.compile = ["file1", "file2", ..., "fileN"]
  cmd.out = "path/to/output/target"
  cmd.target = :library
  cmd.debug
  cmd.define = [:foo, :bar]
  cmd.doc = "path/to/docfile"
  cmd.optimize
end

Required Parameters

Compile

An array of files to compile.

compile = ["file1", "file2"]

Out

The file to output, including extension: exe or dll.

out = "path/to/output/target"

Target

The type of output to create: exe, winexe, library, module, appcontainerexe, winmdobj.

target = :library

Optional Parameters

References

An array of .NET assemblies to reference.

references = ["System.Path", "System.IO"]

Resources

An array of resources to embed into the output.

resources = ["foo.cs", "bar.cs"]

The resources can be specified with Rake's built in FileList, making it easy to use patterns to include or exclude specific files.

resources = FileList["**/*.cs"].exclude("test/")

Debug

Enable debug output, optionally, at a certain level: :full or :pdbonly

debug

or

debug :full

Define

Define compiler constants.

define = [:foo, :bar]

Doc

Produce XML documentation at this location.

doc = "path/to/docfile"

Optimize

Turn on compiler optimizations.

optimize

Delay Sign

The assembly is not fully signed when created.

delay_sign

Main

The type that contains the entry point.

main = "HelloWorld"

Key File & Key Container

The key file and container.

key_file = "path/to/keyfile"
key_container = "KeyContainer"

No Logo

Hide the startup banner and logo.

no_logo

Guidance

(none)

Clone this wiki locally