-
Notifications
You must be signed in to change notification settings - Fork 0
CSC Task
The CSC task allows you to run the C# Compiler (csc.exe) directly, to compile your code and build your projects.
You can specify an array of files to build – your .cs files – what level of debug information to produce, define compiler constants, and more:
csc :build do |csc|
csc.compile "file1", "file2", ... "fileN"
csc.ouput = "myproject.dll"
csc.target :library
csc.debug = true # true, false, :full, :pdbonly
csc.define :whatever, :something, :etc
csc.doc = "path/to/docfile.xml"
csc.optimize = true # true or false
end
The resources can also be specified with Rake’s built in FileList, making it easy to use patterns to include or exclude specific files.
csc :build_app do |csc|
# exclude the test folder, which contains unit test code
csc.resources FileList["**/*.cs"].exclude "test/"
csc.output = "myproject.dll"
# other options, here
end
csc :build_tests do |csc|
csc.resources FileList["test/**/*.cs"]
# reference the project we already built, so our tests will find the classes they are testing
csc.references "myproject.dll"
# other options here
end
The CSC task provides a .use method that tells the task which version of the .NET framework to use, to find the “csc.exe” tool. This method sets the .command attribute for you, and can be called from the Albacore.configure section, to set the .NET version to use, for all instances of the CSC task.
The default version is .NET 4.0. You only need to specify the version to use, if you need something other than this.
Albacore.configure do |config|
config.csc.use :net35
end
csc :build do |csc|
# override the pre-configured value for this specific task instance
csc.use :net20
end
Valid values for the .NET version to use, are:
- :net2
- :net20
- :net35
- :net4
- :net40
The following parameters are available for the CSC task.
Set the location of the “csc.exe” tool.
An array of files to compile.
An array of .NET assemblies to reference
An array of resources to embed into the output.
The file to output, including exection: .exe, .dll, etc. For example “myproject.dll” or “myproject.exe”
The type of output to create, specified as a symbol. See the MSDN documentation for a complete list.
Set the level of debug output.
- true
- false
- :full
- :pdbonly
Define compiler constants.
Produce xml documentation at this location.
Turn on, or off, compiler optimizations: true or false
- Build-Server Integration
- Command Line Task Options
- Configuration
- Custom Tasks
- Logging Options
- Sample Usages
- Task Arguments and Rakefile Parameters
- YAML Configuration
- ASP.NET Compiler - ASP.Net website compiler
- Assembly Info Generator - generate assembly info dynamically
- CSC - C# compiler
- Exec - Execute arbitrary cmd
- Fluent Migrator - Run FluentMigrator on migration library
- ILMerge - Merge dll/exe-s together
- MSBuild and XBuild - Compile a .sln-file or a MsBuild xml-file
- MSpec - Test using MSpec (machine.specifications)
- MSTest - Test using Microsoft Test Framework
- NAnt - Run a NAnt script
- NChurn - Calculate per-file churn
- NCover Console - Run NCover for tests/library
- NCover Reports - Generate a report from a coverage run
- NDepend - Run NDepend to check static code metrics
- NuGet Install - Install NuGet packages
- NuGet Pack - Create NuGet packages
- NuGet Push - Push NuGet packages to official MS repo
- NuGet Publish - Publish NuGet packages
- NUnit - Test using NUnit
- NuSpec - Generate a NuSpec file
- Output - File copying and template expansion
- PLink - SSH into a remote computer and run a command
- SQLCmd - Run a SQL command as a part of your build process
- UnZip - Unzip a directory
- XBuild - Run XBuild (will be merged into MsBuild)
- XUnit - Test using XUnit
- Zip - Zip a directory or files
- Edit the Wiki Locally - How to edit the wiki without using Github's interface
- How to Build Albacore
- How to Contribute