NAnt SDK Documentation - v0.92

CscTask Class

Compiles C# programs.

For a list of all members of this type, see CscTask Members.

System.Object
   NAnt.Core.Element
      NAnt.Core.Task
         NAnt.Core.Tasks.ExternalProgramBase
            NAnt.DotNet.Tasks.CompilerBase
               NAnt.DotNet.Tasks.CscTask

[Visual Basic]
<TaskName(Name:="csc"), _  ProgramLocation(LocationType:=LocationType.FrameworkDir)>
Public Class CscTask
    Inherits CompilerBase
[C#]
[TaskName(Name="csc")]
[ProgramLocation(LocationType=LocationType.FrameworkDir)]
public class CscTask : CompilerBase

Thread Safety

Public static (Shared in Visual Basic) members of this type are safe for multithreaded operations. Instance members are not guaranteed to be thread-safe.

Remarks

Note    In order to have CscTask generate manifest resource names that match those generated by Microsoft Visual Studio.NET, the value of the Prefix attribute of the <ResourcesList> element should match the "Default Namespace" of the C# project, and the value of the DynamicPrefix attribute should be set to "true".

Example

Compile a "HelloWorld" application, including embedded resources.

    
<csc target="exe" output="HelloWorld.exe" debug="true">
    <nowarn>
        <!-- do not report warnings for missing XML comments -->
        <warning number="0519" />
    </nowarn>
    <sources>
        <include name="**/*.cs" />
    </sources>
    <resources dynamicprefix="true" prefix="HelloWorld">
        <include name="**/*.resx" />
    </resources>
    <references>
        <include name="System.dll" />
        <include name="System.Data.dll" />
    </references>
</csc>
    
  

Requirements

Namespace: NAnt.DotNet.Tasks

Assembly: NAnt.DotNetTasks (in NAnt.DotNetTasks.dll)

See Also

CscTask Members | NAnt.DotNet.Tasks Namespace