You can not select more than 25 topics Topics must start with a chinese character,a letter or number, can include dashes ('-') and can be up to 35 characters long.

dotnet.html 16 KiB

123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354555657585960616263646566676869707172737475767778798081828384858687888990919293949596979899100101102103104105106107108109110111112113114115116117118119120121122123124125126127128129130131132133134135136137138139140141142143144145146147148149150151152153154155156157158159160161162163164165166167168169170171172173174175176177178179180181182183184185186187188189190191192193194195196197198199200201202203204205206207208209210211212213214215216217218219220221222223224225226227228229230231232233234235236237238239240241242243244245246247248249250251252253254255256257258259260261262263264265266267268269270271272273274275276277278279280281282283284285286287288289290291292293294295296297298299300301302303304305306307308309310311312313314315316317318319320321322323324325326327328329330331332333334335336337338339340341342343344345346347348349350351352353354355356357358359360361362363364365366367368369370371372373374375376377378379380381382383384385386387388389390391392393394395396397398399400401402403404405406407408409410411412413414415416417418419420421422423424425426427428429430431432433434435436437438439440441442443444445446447448449450451452453454455456457458459460461462463464465466467468469470471472473474475476477478479480481482483484485486487488489490491492493494495
  1. <html>
  2. <head>
  3. <title>.NET Tasks</title>
  4. </head>
  5. <body>
  6. <h1>.NET tasks</h1>
  7. <hr>
  8. <h2>&lt;CSC&gt;</h2>
  9. This task compiles CSharp source into executables or modules.
  10. This task compiles CSharp source into executables or modules. The task will
  11. only work on win2K/XP or other platforms with csc.exe or an equivalent.
  12. CSC must be on the execute path.
  13. <p>
  14. All parameters are optional: &lt;csc/&gt; should suffice to produce a debug
  15. build of all *.cs files. References to external files do require explicit
  16. enumeration, so are one of the first attributes to consider adding. </p>
  17. <p>
  18. The task is a directory based task, so attributes like
  19. <b>includes=&quot;**/*.cs&quot;</b> and
  20. <b>excludes=&quot;broken.cs&quot;</b> can be used to control
  21. the files pulled in. By default,
  22. all *.cs files from the project folder down are included in the command.
  23. When this happens the destFile -if not specified-
  24. is taken as the first file in the list, which may be somewhat hard to control.
  25. Specifying the output file with <b>'destfile'</b> seems prudent. </p>
  26. <p>
  27. Also, dependency checking only works if destfile is set.
  28. <table border="1" cellpadding="2" cellspacing="0">
  29. <tr>
  30. <td valign="top"><b>Attribute</b></td>
  31. <td valign="top"><b>Description</b></td>
  32. <td align="center" valign="top"><b>Example Values</b></td>
  33. </tr>
  34. <tr>
  35. <td valign="top">additionalModules</td>
  36. <td valign="top">Semicolon separated list of modules to refer to</td>
  37. </tr>
  38. <tr>
  39. <td valign="top">defaultexcludes</td>
  40. <td valign="top">indicates whether default excludes should be used or not
  41. </td>
  42. <td valign="top">&quot;true&quot;(default) or &quot;false&quot;</td>
  43. </tr>
  44. <tr>
  45. <td valign="top">definitions</td>
  46. <td valign="top">defined constants</td>
  47. <td valign="top"> &quot;RELEASE;BETA1&quot;</td>
  48. </tr>
  49. <tr>
  50. <td valign="top">debug</td>
  51. <td valign="top">include debug information</td>
  52. <td valign="top">&quot;true&quot;(default)</td>
  53. </tr>
  54. <tr>
  55. <td valign="top">destFile</td>
  56. <td valign="top">name of exe/library to create</td>
  57. <td valign="top">&quot;example.exe&quot;</td>
  58. </tr>
  59. <tr>
  60. <td valign="top">docFile</td>
  61. <td valign="top">name of file for documentation</td>
  62. <td valign="top">&quot;doc.xml&quot;</td>
  63. </tr>
  64. <tr>
  65. <td valign="top">excludes</td>
  66. <td valign="top">comma- or space-separated list of patterns of files that must be
  67. excluded. No files (except default excludes) are excluded when omitted.</td>
  68. </tr>
  69. <tr>
  70. <td valign="top">excludesfile</td>
  71. <td valign="top">the name of a file. Each line of this file is
  72. taken to be an exclude pattern</td>
  73. </tr>
  74. <tr>
  75. <td valign="top">extraOptions</td>
  76. <td valign="top">Any extra options which aren't explicitly
  77. supported by the CSharp task </td>
  78. <td>&quot;/warnaserror+ /baseaddress:0x12840000&quot;</td>
  79. </tr>
  80. <tr>
  81. <td valign="top">failOnError</td>
  82. <td valign="top">Should a failed compile halt the build?</td>
  83. <td valign="top">&quot;true&quot;(default) or &quot;false&quot;</td>
  84. </tr>
  85. <tr>
  86. <td valign="top">fileAlign</td>
  87. <td valign="top">
  88. set the file alignment.
  89. Valid values are 0,512, 1024, 2048, 4096, 8192, and 16384
  90. 0 means 'leave to the compiler'
  91. </td>
  92. <td valign="top">512</td>
  93. </tr>
  94. <tr>
  95. <td valign="top">fullpaths</td>
  96. <td valign="top">print the full path of files on on errors</td>
  97. </tr>
  98. <tr>
  99. <td valign="top">includes</td>
  100. <td valign="top">comma- or space-separated list of patterns of files that must be
  101. included. All files are included when omitted.</td>
  102. </tr>
  103. <tr>
  104. <td valign="top">includeDefaultReferences</td>
  105. <td valign="top">Flag which when true automatically includes
  106. the common assemblies in dotnet, and tells the compiler to link in
  107. mscore.dll
  108. </td>
  109. <td valign="top">&quot;true&quot;(default) or &quot;false&quot;</td>
  110. </tr>
  111. <tr>
  112. <td valign="top">includesfile</td>
  113. <td valign="top">the name of a file. Each line of this file is
  114. taken to be an include pattern</td>
  115. </tr>
  116. <tr>
  117. <td valign="top">incremental</td>
  118. <td valign="top">Incremental build flag. Avoid till it works</td>
  119. <td valign="top">&quot;true&quot; or &quot;false&quot;(default)</td>
  120. </tr>
  121. <tr>
  122. <td valign="top">mainClass</td>
  123. <td valign="top">name of main class for executables</td>
  124. <td valign="top">&quot;com.example.project.entrypoint&quot;</td>
  125. </tr>
  126. <tr>
  127. <td valign="top">noConfig</td>
  128. <td valign="top">a flag which tells the compiler not
  129. to read in the compiler settings files 'csc.rsp' in its
  130. bin directory and then the local directory</td>
  131. <td valign="top">&quot;true&quot; or &quot;false&quot;(default)</td>
  132. </tr>
  133. <tr>
  134. <td valign="top">optimize</td>
  135. <td valign="top">optimisation flag</td>
  136. <td valign="top">&quot;true&quot; or &quot;false&quot;(default)</td>
  137. </tr>
  138. <tr>
  139. <td valign="top">references</td>
  140. <td valign="top">Semicolon separated list of dlls to refer to</td>
  141. <td valign="top">&quot;mylib.dll;nunit.dll&quot;</td>
  142. </tr>
  143. <tr>
  144. <td valign="top">referenceFiles </td>
  145. <td valign="top">Ant Path descriptioon of references to include.
  146. Wildcards should work. </td>
  147. <td valign="top"></td>
  148. </tr>
  149. <tr>
  150. <td valign="top">srcDir</td>
  151. <td valign="top">source directory (default = project directory)</td>
  152. <td valign="top">&quot;.&quot;</td>
  153. </tr>
  154. <tr>
  155. <td valign="top">targetType</td>
  156. <td valign="top">Type of target</td>
  157. <td valign="top">&quot;exe&quot;, &quot;module&quot;, &quot;winexe&quot; or &quot;library&quot;</td>
  158. </tr>
  159. <tr>
  160. <td valign="top">unsafe</td>
  161. <td valign="top">enable the <b>unsafe</b> keyword</td>
  162. <td valign="top">&quot;true&quot; or &quot;false&quot;(default)</td>
  163. </tr>
  164. <tr>
  165. <td valign="top">utf8output</td>
  166. <td valign="top">require all compiler output to be in utf-8 format</td>
  167. <td valign="top">&quot;true&quot; or &quot;false&quot;(default)</td>
  168. </tr>
  169. <tr>
  170. <td valign="top">warnLevel</td>
  171. <td valign="top">level of warning currently between 1 and 4 with 4
  172. being the strictest. </td>
  173. <td valign="top">&quot;1&quot;-&quot;4&quot;</td>
  174. </tr>
  175. <tr>
  176. <td valign="top">win32Icon</td>
  177. <td valign="top">filename of icon to include</td>
  178. <td valign="top">&quot;res/myicon.ico&quot;</td>
  179. </tr>
  180. <tr>
  181. <td valign="top">win32res</td>
  182. <td valign="top">filename of a win32 resource (.RES)file to include
  183. This is not a .NET resource, but it what windows is used to.</td>
  184. <td valign="top">&quot;res/myapp.res&quot;</td>
  185. </tr>
  186. </table>
  187. <p>
  188. Example
  189. </p>
  190. <pre>&lt;csc
  191. optimize=&quot;true&quot;
  192. debug=&quot;false&quot;
  193. docFile=&quot;documentation.xml&quot;
  194. warnLevel=&quot;4&quot;
  195. unsafe=&quot;false&quot;
  196. targetType=&quot;exe&quot;
  197. incremental=&quot;false&quot;
  198. definitions=&quot;RELEASE&quot;
  199. excludes=&quot;src/unicode_class.cs&quot;
  200. mainClass = &quot;MainApp&quot;
  201. destFile=&quot;NetApp.exe&quot;
  202. /&gt;
  203. </pre>
  204. <hr>
  205. <h2>&lt;ilasm&gt;</h2>
  206. <p>Task to assemble .net 'Intermediate Language' files.
  207. The task will only work on windows until other platforms support csc.exe or
  208. an equivalent. ilasm.exe must be on the execute path too.
  209. </p>
  210. <p>
  211. All parameters are optional: &lt;il/&gt; should suffice to produce a debug
  212. build of all *.il files.
  213. The option set is roughly compatible with the CSharp class;
  214. even though the command line options are only vaguely
  215. equivalent. [The low level commands take things like /OUT=file,
  216. csc wants /out:file ... /verbose is used some places; /quiet here in
  217. ildasm... etc.] It would be nice if someone made all the command line
  218. tools consistent (and not as brittle as the java cmdline tools)
  219. </p>
  220. <p>
  221. The task is a directory based task, so attributes like <b>includes=&quot;*.il&quot;</b> and
  222. <b>excludes=&quot;broken.il&quot;</b> can be used to control the files pulled in.
  223. Each file is built on its own, producing an appropriately named output file unless
  224. manually specified with <b>outfile</b>
  225. </p>
  226. <table border="1" cellpadding="2" cellspacing="0">
  227. <tr>
  228. <td valign="top"><b>Attribute</b></td>
  229. <td valign="top"><b>Description</b></td>
  230. <td align="center" valign="top"><b>Example</b></td>
  231. </tr>
  232. <tr>
  233. <td valign="top">defaultexcludes</td>
  234. <td valign="top">indicates whether default excludes should be used or not
  235. (&quot;yes&quot;/&quot;no&quot;). Default excludes are used when omitted.</td>
  236. </tr>
  237. <tr>
  238. <td valign="top">debug</td>
  239. <td valign="top">include debug information</td>
  240. <td valign="top">true (default)</td>
  241. </tr>
  242. <tr>
  243. <td valign="top">excludes</td>
  244. <td valign="top">comma separated list of patterns of files that must be
  245. excluded. No files (except default excludes) are excluded when omitted.</td>
  246. </tr>
  247. <tr>
  248. <td valign="top">excludesfile</td>
  249. <td valign="top">the name of a file. Each line of this file is
  250. taken to be an exclude pattern</td>
  251. </tr>
  252. <tr>
  253. <td valign="top">extraOptions</td>
  254. <td valign="top">Any extra options which aren't explicitly
  255. supported by the ilasm task, primarily because they
  256. arent really documented: use ilasm /? to see them</td>
  257. <td></td>
  258. </tr>
  259. <tr>
  260. <td valign="top">failOnError</td>
  261. <td valign="top">Should a failed compile halt the build?</td>
  262. <td valign="top">&quot;true&quot;(default)</td>
  263. </tr>
  264. <tr>
  265. <td valign="top">fullpaths</td>
  266. <td valign="top">Should error text provide the full path to files</td>
  267. <td valign="top">&quot;true&quot;(default)</td>
  268. </tr>
  269. <tr>
  270. <td valign="top">includes</td>
  271. <td valign="top">comma separated list of patterns of files that must be
  272. included. All files are included when omitted.</td>
  273. </tr>
  274. <tr>
  275. <td valign="top">includesfile</td>
  276. <td valign="top">the name of a file. Each line of this file is
  277. taken to be an include pattern</td>
  278. </tr>
  279. <tr>
  280. <td valign="top">keyfile</td>
  281. <td valign="top">the name of a file containing a private key, with which
  282. the assembly output is checksumed and then MD5 signed
  283. to have a <i>strong name</i></td>
  284. </tr>
  285. <tr>
  286. <td valign="top">listing</td>
  287. <td valign="top">Produce a listing (off by default). Listings go to the
  288. current output stream</td>
  289. <td valign="top">&quot;on&quot;, &quot;off&quot; (default)</td>
  290. </tr>
  291. <tr>
  292. <td valign="top">outputFile</td>
  293. <td valign="top">filename of output</td>
  294. <td valign="top">&quot;example.exe&quot;</td>
  295. </tr>
  296. <tr>
  297. <td valign="top">resourceFile</td>
  298. <td valign="top">name of resource file to include</td>
  299. <td valign="top">&quot;resources.res&quot;</td>
  300. </tr>
  301. <tr>
  302. <td valign="top">srcDir</td>
  303. <td valign="top">source directory (default = project directory)</td>
  304. <td valign="top"></td>
  305. </tr>
  306. <tr>
  307. <td valign="top">targetType</td>
  308. <td valign="top">Type of target. library means DLL is output. </td>
  309. <td valign="top">&quot;exe&quot;(default), &quot;library&quot;</td>
  310. </tr>
  311. <tr>
  312. <td valign="top">verbose</td>
  313. <td valign="top">output progress messages</td>
  314. <td valign="top">&quot;on&quot;, &quot;off&quot; (default)</td>
  315. </tr>
  316. </table>
  317. <p>
  318. Example</p>
  319. <pre>&lt;ilasm
  320. outputFile=&quot;app.exe&quot;
  321. verbose=&quot;on&quot;
  322. listing=&quot;on&quot;
  323. owner=&quot;secret&quot;
  324. /&gt;
  325. </pre>
  326. <h2>&lt;WsdlToDotnet&gt;</h2>
  327. Why add a wrapper to the MS WSDL tool?
  328. So that you can verify that your web services, be they written with Axis or
  329. anyone else's SOAP toolkit, work with .NET clients.
  330. <p>
  331. This task is dependency aware when using a file as a source and destination;
  332. so if you &lt;get&gt; the file (with <code>usetimestamp="true"</code>) then
  333. you only rebuild stuff when the WSDL file is changed. Of course,
  334. if the server generates a new timestamp every time you ask for the WSDL,
  335. this is not enough...use the &lt;filesmatch&gt; &lt;condition&gt; to
  336. to byte for byte comparison against a cached WSDL file then make
  337. the target conditional on that test failing.
  338. <table border="1" cellpadding="2" cellspacing="0">
  339. <tr>
  340. <td valign="top"><b>Attribute</b></td>
  341. <td valign="top"><b>Description</b></td>
  342. <td align="center" valign="top"><b>Example</b></td>
  343. </tr>
  344. <tr>
  345. <td valign="top">destFile</td>
  346. <td valign="top">name of file to generate. Required</td>
  347. <td valign="top">ApacheNet.cs</td>
  348. </tr>
  349. <tr>
  350. <td valign="top">srcFile</td>
  351. <td valign="top">name of WSDL file to use.
  352. Required if url is not set</td>
  353. <td valign="top">service.wsdl</td>
  354. </tr>
  355. <tr>
  356. <td valign="top">url</td>
  357. <td valign="top">url to retrive WSDL from.
  358. required if srcFile is unset</td>
  359. <td valign="top">http://localhost/service?wsdl</td>
  360. </tr>
  361. <tr>
  362. <td valign="top">server</td>
  363. <td valign="top">generate server stubs, not client proxy code.
  364. optional; default false</td>
  365. <td valign="top">"false"(default)</td>
  366. </tr>
  367. <tr>
  368. <td valign="top">namespace</td>
  369. <td valign="top">namespace to place the source in.
  370. optional; default ""</td>
  371. <td valign="top">Apache.Net</td>
  372. </tr>
  373. <tr>
  374. <td valign="top">language</td>
  375. <td valign="top">language; one of "CS", "JS", or "VB"
  376. optional; </td>
  377. <td valign="top"> "CS" (default)</td>
  378. </tr>
  379. <tr>
  380. <td valign="top">failOnError</td>
  381. <td valign="top">Should failure halt the build?</td>
  382. <td valign="top">"true"(default)</td>
  383. </tr>
  384. <tr>
  385. <td valign="top">extraOptions</td>
  386. <td valign="top">Any extra options which aren't explicitly
  387. supported by the task, like all the proxy server config stuff</td>
  388. <td></td>
  389. </tr>
  390. </table>
  391. <hr>
  392. <hr>
  393. <h2> Change Log </h2>
  394. <h4>Version 0.5</h4>
  395. This revision goes along with NET 1.0 (SP1)
  396. <ol>
  397. <li>CSC: added filealign</li>
  398. <li>CSC: added reference to office.dll</li>
  399. <li>CSC: dependency checking! only if destFile is set!
  400. <li>WsdlToDotnet written
  401. </ol>
  402. <h4>Version 0.4</h4>
  403. This is the beta-2 revision of the tasks.
  404. <ol>
  405. <li>ILASM: pulled the owner attribute, added keyfile for giving binaries a strong name
  406. (MD5 hash of the checksum)</li>
  407. <li>CSC: added win32res , noConfig, utf8output, fullpaths</li>
  408. <li>CSC: </li>
  409. </ol>
  410. <h4>Version 0.3</h4>
  411. The changes here reflect Beta-1 of the dotnet SDK and experience of use in
  412. more complex projects. This build does not work with the older SDK,
  413. primarily because the automatic reference feature references libraries
  414. only found in the new SDK version.
  415. <p>
  416. External changes</p>
  417. <ul>
  418. <li>Recursive inclusion of .cs and .il files</li>
  419. <li>Documentation enhanced, includes examples and details of all parameters</li>
  420. <li>The csc task automatically includes the common dotnet assemblies, so
  421. there is no need to remember to refer to 'System.dll', 'System.Web.Services',
  422. etc. This feature can be disabled by setting the 'includeDefaultReferences'
  423. flag to false. </li>
  424. <li> References can also be referred to using the ReferenceFiles parameter, which
  425. is an ant path specification. The old 'references' string is still retained.</li>
  426. <li> An 'extraoptions' attribute enables the build file to include any CSC options
  427. which are not explicitly supported in the CSC task. </li>
  428. </ul>
  429. Internal changes
  430. <ul>
  431. <li>Some minor refactoring (move common code a method)</li>
  432. <li>Application of Jedits JavaStyle task resulted in a major reshaping of
  433. the codebase and the insertion of a blank line every second line. Significant
  434. effort was required to revert some (but not all) changes.</li>
  435. <li>Removed throws clause from methods which can't throw exceptions </li>
  436. </ul>
  437. The test harness has been expanded to include unicode source file
  438. (the build works but the rest of the system has 'issues' with high unicode
  439. package and method names)
  440. <h4>Version 0.2</h4>
  441. First public edition, added to the ant cvs tree. Tested on the PDC build of
  442. the dotnet SDK only, and still immature. The command execution code was
  443. refactored out into a 'NetCommand' class for re-use. The Ilasm task was added
  444. at this time.
  445. <h4>Version 0.1</h4>
  446. Initial proof of concept; very rudimentary support for CSC only.
  447. <p align="center">Copyright &copy; 2000-2002 Apache Software Foundation. All rights
  448. Reserved.</p>
  449. </body>
  450. </html>