1
<!DOCTYPE html PUBLIC "-//W3C//DTD XHTML 1.1//EN" "http://www.w3.org/TR/xhtml11/DTD/xhtml11.dtd">
2
<html xmlns="http://www.w3.org/1999/xhtml">
3
<!-- Documenting T:NAnt.DotNet.Tasks.CscTask-->
5
<meta http-equiv="Content-Language" content="en-ca" />
6
<meta http-equiv="Content-Type" content="text/html; charset=utf-8" />
7
<link rel="stylesheet" type="text/css" href="../style.css" />
8
<title><csc> Task</title>
11
<table width="100%" border="0" cellspacing="0" cellpadding="2" class="NavBar">
13
<td class="NavBar-Cell">
14
<a href="http://nant.sourceforge.net">
17
<img alt="->" src="../images/arrow.gif" />
18
<a href="../index.html">Help</a>
19
<img alt="->" src="../images/arrow.gif" />
20
<a href="../tasks/index.html">Task Reference</a>
21
<img alt="->" src="../images/arrow.gif" /> <csc></td>
22
<td class="NavBar-Cell" align="right">
27
<p> Compiles C# programs. </p>
29
<b>Note:</b> In order to have <a href="../tasks/csc.html"><csc></a> task generate manifest resource names that match those generated by Microsoft Visual Studio.NET, the value of the <code>prefix</code> attribute of the <<code>resources</code>> element should match the "Default Namespace" of the C# project, and the value of the <code>dynamicprefix</code> attribute should be set to "<b>true</b>". </p>
35
<th style="text-align: center;">Type</th>
37
<th style="text-align: center;">Required</th>
40
<td valign="top">baseaddress</td>
41
<td style="text-align: center;">string</td>
42
<td> The preferred base address at which to load a DLL. The default base address for a DLL is set by the .NET Framework common language runtime. </td>
43
<td style="text-align: center;">False</td>
46
<td valign="top">checked</td>
47
<td style="text-align: center;">bool</td>
48
<td> Specifies whether an integer arithmetic statement that is not in the scope of the <code>checked</code> or <code>unchecked</code> keywords and that results in a value outside the range of the data type should cause a run-time exception. The default is <b>false</b>. </td>
49
<td style="text-align: center;">False</td>
52
<td valign="top">codepage</td>
53
<td style="text-align: center;">string</td>
54
<td> Specifies the code page to use for all source code files in the compilation. </td>
55
<td style="text-align: center;">False</td>
58
<td valign="top">debug</td>
59
<td style="text-align: center;">
60
<a href="../enums/NAnt.DotNet.Types.DebugOutput.html">DebugOutput</a>
62
<td> Specifies the type of debugging information generated by the compiler. The default is <code>None</code>. </td>
63
<td style="text-align: center;">False</td>
66
<td valign="top">doc</td>
67
<td style="text-align: center;">file</td>
68
<td> The name of the XML documentation file to generate. </td>
69
<td style="text-align: center;">False</td>
72
<td valign="top">filealign</td>
73
<td style="text-align: center;">int</td>
74
<td> Specifies the size of sections in the output file. Valid values are 512, 1024, 2048, 4096, and 8192. </td>
75
<td style="text-align: center;">False</td>
78
<td valign="top">langversion</td>
79
<td style="text-align: center;">string</td>
80
<td> Causes the compiler to only accept syntax that is included in a given specification. </td>
81
<td style="text-align: center;">False</td>
84
<td valign="top">noconfig</td>
85
<td style="text-align: center;">bool</td>
86
<td> Instructs the compiler not to use implicit references to assemblies. The default is <b>false</b>. </td>
87
<td style="text-align: center;">False</td>
90
<td valign="top">nostdlib</td>
91
<td style="text-align: center;">bool</td>
92
<td> Instructs the compiler not to import mscorlib.dll. The default is <b>false</b>. </td>
93
<td style="text-align: center;">False</td>
96
<td valign="top">optimize</td>
97
<td style="text-align: center;">bool</td>
98
<td> Specifies whether the compiler should perform optimizations to the make output files smaller, faster, and more effecient. The default is <b>false</b>. </td>
99
<td style="text-align: center;">False</td>
102
<td valign="top">platform</td>
103
<td style="text-align: center;">string</td>
104
<td> Specifies which platform version of common language runtime (CLR) can run the output file. </td>
105
<td style="text-align: center;">False</td>
108
<td valign="top">unsafe</td>
109
<td style="text-align: center;">bool</td>
110
<td> Instructs the compiler to allow code that uses the <code>unsafe</code> keyword. The default is <b>false</b>. </td>
111
<td style="text-align: center;">False</td>
114
<td valign="top">warninglevel</td>
115
<td style="text-align: center;">string</td>
116
<td> Specifies the warning level for the compiler to display. Valid values are <code>0</code>-<code>4</code>. The default is <code>4</code>. </td>
117
<td style="text-align: center;">False</td>
120
<td valign="top" class="required">output</td>
121
<td style="text-align: center;">file</td>
122
<td> The output file created by the compiler. </td>
123
<td style="text-align: center;">True</td>
126
<td valign="top" class="required">target</td>
127
<td style="text-align: center;">string</td>
128
<td> Output type. Possible values are <code>exe</code>, <code>winexe</code>, <code>library</code> or <code>module</code>. </td>
129
<td style="text-align: center;">True</td>
132
<td valign="top">define</td>
133
<td style="text-align: center;">string</td>
134
<td> Define conditional compilation symbol(s). </td>
135
<td style="text-align: center;">False</td>
138
<td valign="top">delaysign</td>
139
<td style="text-align: center;">
140
<a href="../enums/NAnt.DotNet.Types.DelaySign.html">DelaySign</a>
142
<td> Specifies whether to delay sign the assembly using only the public portion of the strong name key. The default is <code>NotSet</code>. </td>
143
<td style="text-align: center;">False</td>
146
<td valign="top">failonerror</td>
147
<td style="text-align: center;">bool</td>
148
<td> Determines if task failure stops the build, or is just reported. The default is <b>true</b>. </td>
149
<td style="text-align: center;">False</td>
152
<td valign="top">if</td>
153
<td style="text-align: center;">bool</td>
154
<td> If <b>true</b> then the task will be executed; otherwise, skipped. The default is <b>true</b>. </td>
155
<td style="text-align: center;">False</td>
158
<td valign="top">keycontainer</td>
159
<td style="text-align: center;">string</td>
160
<td> Specifies the key pair container used to strongname the assembly. </td>
161
<td style="text-align: center;">False</td>
164
<td valign="top">keyfile</td>
165
<td style="text-align: center;">file</td>
166
<td> Specifies a strong name key file. </td>
167
<td style="text-align: center;">False</td>
170
<td valign="top">main</td>
171
<td style="text-align: center;">string</td>
172
<td> Specifies which type contains the Main method that you want to use as the entry point into the program. </td>
173
<td style="text-align: center;">False</td>
176
<td valign="top">nowarn</td>
177
<td style="text-align: center;">string</td>
179
<i>Deprecated.</i> Specifies a comma-separated list of warnings that should be suppressed by the compiler. </td>
180
<td style="text-align: center;">False</td>
183
<td valign="top">rebuild</td>
184
<td style="text-align: center;">bool</td>
185
<td> Instructs NAnt to recompile the output file regardless of the file timestamps. </td>
186
<td style="text-align: center;">False</td>
189
<td valign="top">timeout</td>
190
<td style="text-align: center;">int</td>
191
<td> The maximum amount of time the application is allowed to execute, expressed in milliseconds. Defaults to no time-out. </td>
192
<td style="text-align: center;">False</td>
195
<td valign="top">unless</td>
196
<td style="text-align: center;">bool</td>
197
<td> Opposite of <code>if</code>. If <b>false</b> then the task will be executed; otherwise, skipped. The default is <b>false</b>. </td>
198
<td style="text-align: center;">False</td>
201
<td valign="top">verbose</td>
202
<td style="text-align: center;">bool</td>
203
<td> Determines whether the task should report detailed build log messages. The default is <b>false</b>. </td>
204
<td style="text-align: center;">False</td>
207
<td valign="top">warnaserror</td>
208
<td style="text-align: center;">bool</td>
209
<td> Instructs the compiler to treat all warnings as errors. The default is <b>false</b>. </td>
210
<td style="text-align: center;">False</td>
213
<td valign="top">win32icon</td>
214
<td style="text-align: center;">file</td>
215
<td> Icon to associate with the application. </td>
216
<td style="text-align: center;">False</td>
219
<td valign="top">win32res</td>
220
<td style="text-align: center;">file</td>
221
<td> Specifies a Win32 resource file (.res). </td>
222
<td style="text-align: center;">False</td>
226
<h3>Framework-configurable parameters</h3>
231
<th style="text-align: center;">Type</th>
233
<th style="text-align: center;">Required</th>
236
<td valign="top">exename</td>
237
<td style="text-align: center;">string</td>
238
<td> The name of the executable that should be used to launch the external program. </td>
239
<td style="text-align: center;">False</td>
242
<td valign="top">managed</td>
243
<td style="text-align: center;">
244
<a href="../enums/NAnt.Core.Types.ManagedExecution.html">ManagedExecution</a>
246
<td> Specifies whether the external program should be treated as a managed application, possibly forcing it to be executed under the currently targeted version of the CLR. </td>
247
<td style="text-align: center;">False</td>
250
<td valign="top">noconfig</td>
251
<td style="text-align: center;">bool</td>
252
<td> Instructs the compiler not to use implicit references to assemblies. The default is <b>false</b>. </td>
253
<td style="text-align: center;">False</td>
256
<td valign="top">nostdlib</td>
257
<td style="text-align: center;">bool</td>
258
<td> Instructs the compiler not to import mscorlib.dll. The default is <b>false</b>. </td>
259
<td style="text-align: center;">False</td>
262
<td valign="top">supportsdelaysign</td>
263
<td style="text-align: center;">bool</td>
264
<td> Indicates whether the compiler for a given target framework supports the "delaysign" option. The default is <b>false</b>. </td>
265
<td style="text-align: center;">False</td>
268
<td valign="top">supportsdocgeneration</td>
269
<td style="text-align: center;">bool</td>
270
<td> Specifies whether the compiler for the active target framework supports generation of XML Documentation file. The default is <b>true</b>. </td>
271
<td style="text-align: center;">False</td>
274
<td valign="top">supportskeycontainer</td>
275
<td style="text-align: center;">bool</td>
276
<td> Indicates whether the compiler for a given target framework supports the "keycontainer" option. The default is <b>false</b>. </td>
277
<td style="text-align: center;">False</td>
280
<td valign="top">supportskeyfile</td>
281
<td style="text-align: center;">bool</td>
282
<td> Indicates whether the compiler for a given target framework supports the "keyfile" option. The default is <b>false</b>. </td>
283
<td style="text-align: center;">False</td>
286
<td valign="top">supportslangversion</td>
287
<td style="text-align: center;">bool</td>
288
<td> Specifies whether the compiler for the active target framework supports accepting only a specific language syntax. The default is <b>false</b>. </td>
289
<td style="text-align: center;">False</td>
292
<td valign="top">supportsnowarnlist</td>
293
<td style="text-align: center;">bool</td>
294
<td> Indicates whether the compiler for a given target framework supports a command line option that allows a list of warnings to be suppressed. The default is <b>false</b>. </td>
295
<td style="text-align: center;">False</td>
298
<td valign="top">supportspackagereferences</td>
299
<td style="text-align: center;">bool</td>
300
<td> Indicates whether package references are supported by compiler for a given target framework. The default is <b>false</b>. </td>
301
<td style="text-align: center;">False</td>
304
<td valign="top">supportsplatform</td>
305
<td style="text-align: center;">bool</td>
306
<td> Specifies whether the compiler for the active target framework supports limiting the platform on which the compiled code can run. The default is <b>false</b>. </td>
307
<td style="text-align: center;">False</td>
310
<td valign="top">supportswarnaserrorlist</td>
311
<td style="text-align: center;">bool</td>
312
<td> Indicates whether the compiler for a given target framework supports the "warnaserror" option that takes a list of warnings. The default is <b>false</b>. </td>
313
<td style="text-align: center;">False</td>
316
<td valign="top">useruntimeengine</td>
317
<td style="text-align: center;">bool</td>
319
<i>Deprecated.</i> Specifies whether the external program is a managed application which should be executed using a runtime engine, if configured. The default is <b>false</b>. </td>
320
<td style="text-align: center;">False</td>
324
<h3>Nested Elements:</h3>
329
<<a href="../types/warnaserror.html">warnaserror</a>>
331
<div class="nested-element"> Controls which warnings should be reported as errors. <p /></div>
335
</<a href="../types/warnaserror.html">warnaserror</a>>
343
<div class="nested-element"> Specifies a list of warnings that you want the compiler to suppress. <h5><warning></h5><div class="nested-element"><p> Represents a compiler warning. </p><h3>Parameters</h3><div class="table"><table><tr><th>Attribute</th><th style="text-align: center;">Type</th><th>Description</th><th style="text-align: center;">Required</th></tr><tr><td valign="top" class="required">number</td><td style="text-align: center;">string</td><td> A warning number, or comma-separated list of warnings, that you want the compiler to suppress or report. </td><td style="text-align: center;">True</td></tr><tr><td valign="top">if</td><td style="text-align: center;">bool</td><td> If <b>true</b> then the element will be processed; otherwise, skipped. The default is <b>true</b>. </td><td style="text-align: center;">False</td></tr><tr><td valign="top">unless</td><td style="text-align: center;">bool</td><td> If <b>true</b> then the element will be skipped; otherwise, processed. The default is <b>false</b>. </td><td style="text-align: center;">False</td></tr></table></div></div><h5></warning></h5></div>
344
<h4></nowarn></h4>
349
<<a href="../types/fileset.html">lib</a>>
351
<div class="nested-element">
352
<i>Deprecated.</i> Additional directories to search in for assembly references. <p /></div>
356
</<a href="../types/fileset.html">lib</a>>
362
<<a href="../types/assemblyfileset.html">references</a>>
364
<div class="nested-element"> Reference metadata from the specified assembly files. <p /></div>
368
</<a href="../types/assemblyfileset.html">references</a>>
372
<a id="pkg-references">
374
<pkg-references>
376
<div class="nested-element"> Specifies list of packages to reference. <h5><package></h5><div class="nested-element"><p> Represents a package. </p><h3>Parameters</h3><div class="table"><table><tr><th>Attribute</th><th style="text-align: center;">Type</th><th>Description</th><th style="text-align: center;">Required</th></tr><tr><td valign="top" class="required">name</td><td style="text-align: center;">string</td><td> Name of the package to reference. Multiple package can be specified with a single element as a semi-colon separated list of package names. </td><td style="text-align: center;">True</td></tr><tr><td valign="top">if</td><td style="text-align: center;">bool</td><td> Indicates if the package should be passed to the task. If <b>true</b> then the package will be passed; otherwise, skipped. The default is <b>true</b>. </td><td style="text-align: center;">False</td></tr><tr><td valign="top">unless</td><td style="text-align: center;">bool</td><td> Indicates if the package should not be passed to the task. If <b>false</b> then the package will be passed; otherwise, skipped. The default is <b>false</b>. </td><td style="text-align: center;">False</td></tr></table></div></div><h5></package></h5></div>
377
<h4></pkg-references></h4>
379
<!--NestedElementArray=T:NAnt.DotNet.Types.ResourceFileSet-->
383
<<a href="../types/resourcefileset.html">resources</a>>
385
<div class="nested-element"> Resources to embed. </div>
389
</<a href="../types/resourcefileset.html">resources</a>>
395
<<a href="../types/assemblyfileset.html">modules</a>>
397
<div class="nested-element"> Link the specified modules into this assembly. <p /></div>
401
</<a href="../types/assemblyfileset.html">modules</a>>
407
<<a href="../types/fileset.html">sources</a>>
409
<div class="nested-element"> The set of source files for compilation. <p /></div>
413
</<a href="../types/fileset.html">sources</a>>
416
<!--NestedElementArray=T:NAnt.Core.Types.Argument-->
422
<div class="nested-element"> The command-line arguments for the external program. <p> Represents a command-line argument. </p><p> When passed to an external application, the argument will be quoted when appropriate. This does not apply to the <code>line</code> parameter, which is always passed as is. </p><h3>Parameters</h3><div class="table"><table><tr><th>Attribute</th><th style="text-align: center;">Type</th><th>Description</th><th style="text-align: center;">Required</th></tr><tr><td valign="top">dir</td><td style="text-align: center;">directory</td><td> The value for a directory-based command-line argument; will be replaced with the absolute path of the directory. </td><td style="text-align: center;">False</td></tr><tr><td valign="top">file</td><td style="text-align: center;">file</td><td> The name of a file as a single command-line argument; will be replaced with the absolute filename of the file. </td><td style="text-align: center;">False</td></tr><tr><td valign="top">if</td><td style="text-align: center;">bool</td><td> Indicates if the argument should be passed to the external program. If <b>true</b> then the argument will be passed; otherwise, skipped. The default is <b>true</b>. </td><td style="text-align: center;">False</td></tr><tr><td valign="top">line</td><td style="text-align: center;">string</td><td> List of command-line arguments; will be passed to the executable as is. </td><td style="text-align: center;">False</td></tr><tr><td valign="top">path</td><td style="text-align: center;"><path></td><td> The value for a PATH-like command-line argument; you can use <code>:</code> or <code>;</code> as path separators and NAnt will convert it to the platform's local conventions, while resolving references to environment variables. </td><td style="text-align: center;">False</td></tr><tr><td valign="top">unless</td><td style="text-align: center;">bool</td><td> Indicates if the argument should not be passed to the external program. If <b>false</b> then the argument will be passed; otherwise, skipped. The default is <b>false</b>. </td><td style="text-align: center;">False</td></tr><tr><td valign="top">value</td><td style="text-align: center;">string</td><td> A single command-line argument; can contain space characters. </td><td style="text-align: center;">False</td></tr></table></div><h3>Nested Elements:</h3><!--Element--><h4><a id="path"></a>
423
<<a href="../types/path.html">path</a>>
424
</h4><div class="nested-element"> Sets a single command-line argument and treats it like a PATH - ensures the right separator for the local platform is used. <p /></div><h4><a id="path"></a>
425
</<a href="../types/path.html">path</a>>
426
</h4><h3>Examples</h3><ul class="examples"><li><p> A single command-line argument containing a space character. </p><pre class="code">
427
<arg value="-l -a" />
428
</pre></li><li><p> Two separate command-line arguments. </p><pre class="code">
429
<arg line="-l -a" />
430
</pre></li><li><p> A single command-line argument with the value <code>\dir;\dir2;\dir3</code> on DOS-based systems and <code>/dir:/dir2:/dir3</code> on Unix-like systems. </p><pre class="code">
431
<arg path="/dir;/dir2:\dir3" />
432
</pre></li></ul></div>
439
<ul class="examples">
441
<p>Compile a "HelloWorld" application, including embedded resources.</p>
443
<csc target="exe" output="HelloWorld.exe" debug="true">
445
<!-- do not report warnings for missing XML comments -->
446
<warning number="0519" />
449
<include name="**/*.cs" />
451
<resources dynamicprefix="true" prefix="HelloWorld">
452
<include name="**/*.resx" />
455
<include name="System.dll" />
456
<include name="System.Data.dll" />
462
<h3>Requirements</h3>
463
<div style="margin-left: 20px;">
464
<b>Assembly:</b> NAnt.DotNetTasks (0.90.3780.0)
b'\\ No newline at end of file'