JamPlus manual
C# Rules
IncludeModule csharp ;

The CSharp module currently has no automatic detection of C# compilers available on the system. For that reason, the variable CSC_COMPILER is provided. CSC_COMPILER may be set to one of the following values before the CSharp module is loaded. It is advised to pass CSC_COMPILER to Jam from the command line.

  • mono - Use an available Mono compiler on the system.
  • vs2005 - Use the .NET Framework 2.0.
  • vs2008 (default) - Use the .NET Framework 3.5.

List of Rules

Rules


rule CSharp.CscDefines TARGET : DEFINES [ : THE_CONFIG ]

For the given C# project TARGET, assign the DEFINES to the configuration THE_CONFIG.

Parameters
TARGETThe target to assign the DEFINES to. TARGET is optional if rule ActiveTarget TARGET has been specified. If TARGET is *, the defines are made available globally.
DEFINESThe list of defines to apply.
THE_CONFIG(optional) If not specified, the default is all configurations.
# Make #defines available for ABC and DEF=5 in csharpproject for all
# configurations and all platforms.
CSharp.CscDefines csharpproject : ABC DEF=5 ;
# Add a GHI define globally.
CSharp.CscDefines * : GHI ;

rule CSharp.CscFlags TARGET : FLAGS [ : THE_CONFIG ]

For the given C# project TARGET, assign the FLAGS to the configuration THE_CONFIG.

Parameters
TARGETThe target to assign the FLAGS to. TARGET is optional if rule ActiveTarget TARGET has been specified. If TARGET is *, the flags are made available globally.
FLAGSThe list of flags to apply.
THE_CONFIG(optional) If not specified, the default is all configurations.
# Assign /platform:x86 to all configurations of the target csharpapp.
CSharp.CscFlags csharpapp : /platform:x86 ;
# Turn on optimizations for the Release configuration.
CSharp.CscFlags csharpapp : /optimize+ : release ;

rule CSharp.Application TARGET : SOURCES [ : OPTIONS ]

Compiles C# SOURCES and links them into TARGET. This is just a passthrough rule for rule_CSharp_Assembly "CSharpAssembly".

CSharp.Application helloworld : helloworld.cs ;

rule CSharp.Assembly TARGET : SOURCES [ : OPTIONS ]

Compiles C# SOURCES and links them into TARGET.

Parameters
TARGETThe target to link SOURCES into. The target name is given without extension. A platform specific extension will be generated, often reflecting a configuration type. TARGET is optional if rule ActiveTarget TARGET has been specified.
SOURCESThe list of .cs files to link into the application.
OPTIONS(optional) The following options are available:

  • console (default) - Builds a console application.
  • library - Builds a library.
  • module - Builds a module.
  • windows - Builds a GUI application.

CSharp.Assembly helloworld : helloworld.cs ;

rule CSharp.Library TARGET : SOURCES [ : OPTIONS ]

Compiles C# SOURCES and links them into the library TARGET. This is just a passthrough rule for rule_CSharp_Assembly "CSharpAssembly" with the library option.

CSharp.Library mylibrary : mysource.cs ;

rule CSharp.ReferenceAssemblies TARGET : ASSEMBLIES [ : THE_CONFIG ]

Makes TARGET depend on ASSEMBLIES and includes them during linking.

Parameters
TARGETThe target to link ASSEMBLIES to. TARGET is optional if rule ActiveTarget TARGET has been specified.
ASSEMBLIESThe list of assemblies to apply. These libraries are prebuilt assemblies, such as System.Core.dll. For those assemblies generated from the CSharpAssembly rule, use the "LinkAssemblies" rule.
THE_CONFIG(optional) If not specified, the default is all configurations.
CSharp.ReferenceAssemblies WindowsFormsApplication :
System.Core.dll
System.Data.DataSetExtensions.dll
System.Data.dll
System.Deployment.dll
System.dll
System.Drawing.dll
System.Windows.Forms.dll
System.Xml.dll
System.Xml.Linq.dll
;

rule CSharp.ReferencePaths TARGET : PATHS [ : THE_CONFIG ]

For the given project TARGET, make the reference search paths PATHS available to configuration THE_CONFIG.

Parameters
TARGETThe target to assign the reference paths to. TARGET is optional if rule ActiveTarget TARGET has been specified. If TARGET is *, the defines are made available globally.
PATHSThe list of reference search paths to apply. Absolute paths are used directly. Relative paths are local to . That is, they are relative to the subdirectory specified via SubDir.
THE_CONFIG(optional) If not specified, the default is all configurations.
# Add c:/assemblies to myproject for all configurations.
CSharp.ReferencePaths myproject : c:/assemblies ;
# Relative path:
CSharp.ReferencePaths myproject : ../libs ;