~ubuntu-branches/ubuntu/feisty/nant/feisty

« back to all changes in this revision

Viewing changes to doc/help/tasks/script.html

  • Committer: Bazaar Package Importer
  • Author(s): Dave Beckett
  • Date: 2006-06-12 23:30:36 UTC
  • mfrom: (1.1.2 upstream)
  • Revision ID: james.westby@ubuntu.com-20060612233036-a1uwh0949z0218ep
Tags: 0.84+0.85-rc4-1
* New upstream release
* Acknowledge NMU (Closes: #372588)
* Standards-Version 3.7.2
* Update to latest CLI policy package split.  Build-Depends-Indep: on
  cli-common-dev, libmono-winforms1.0-cil, libmono-winforms2.0-cil and
  mono-gmcs to get 1.0 and 2.0 packages
* Removed patches no longer needed:
  - 01-AssemblyInfoTask.cs.patch
  - 02-ScriptTask.cs.patch
  - 03-XmlResultFormatter.cs.patch
  - 04-SourceControl.patch
  - 05-ExceptionTest.cs

Show diffs side-by-side

added added

removed removed

Lines of Context:
1
 
<!DOCTYPE html PUBLIC "-//w3c//dtd xhtml 1.1 strict//en" "http://www.w3.org/TR/xhtml11/DTD/xhtml11.dtd">
 
1
<!DOCTYPE html PUBLIC "-//W3C//DTD XHTML 1.1//EN" "http://www.w3.org/TR/xhtml11/DTD/xhtml11.dtd">
2
2
<html xmlns="http://www.w3.org/1999/xhtml">
3
3
  <!-- Documenting T:NAnt.DotNet.Tasks.ScriptTask-->
4
4
  <head>
20
20
          <a href="../tasks/index.html">Task Reference</a>
21
21
          <img alt="-&gt;" src="../images/arrow.gif" /> &lt;script&gt;</td>
22
22
        <td class="NavBar-Cell" align="right">
23
 
                        v0.85-rc3</td>
 
23
                        v0.85-rc4</td>
24
24
      </tr>
25
25
    </table>
26
26
    <h1>&lt;script&gt;</h1>
159
159
</pre>
160
160
      </li>
161
161
      <li>
162
 
        <p>Run Visual Basic.NET code that writes a message to the build log.</p>
 
162
        <p>Use a custom namespace in C# to create a database</p>
 
163
        <pre class="code">      &lt;script language="C#" &gt;
 
164
          &lt;references&gt;
 
165
              &lt;include name="System.Data.dll" /&gt;
 
166
          &lt;/references&gt;
 
167
          &lt;imports&gt;
 
168
              &lt;import namespace="System.Data.SqlClient" /&gt;
 
169
          &lt;/imports&gt;
 
170
          &lt;code&gt;
 
171
            &lt;![CDATA[
 
172
              public static void ScriptMain(Project project) {
 
173
                  string dbUserName = "nant";
 
174
                  string dbPassword = "nant";
 
175
                  string dbServer = "(local)";
 
176
                  string dbDatabaseName = "NAntSample";
 
177
                  string connectionString = String.Format("Server={0};uid={1};pwd={2};", dbServer, dbUserName, dbPassword);
 
178
                  
 
179
                  SqlConnection connection = new SqlConnection(connectionString);
 
180
                  string createDbQuery = "CREATE DATABASE " + dbDatabaseName;
 
181
                  SqlCommand createDatabaseCommand = new SqlCommand(createDbQuery);
 
182
                  createDatabaseCommand.Connection = connection;
 
183
                  
 
184
                  connection.Open();
 
185
                  
 
186
                  try {
 
187
                      createDatabaseCommand.ExecuteNonQuery();
 
188
                      project.Log(Level.Info, "Database added successfully: " + dbDatabaseName);
 
189
                  } catch (Exception e) {
 
190
                      project.Log(Level.Error, e.ToString());
 
191
                  } finally {
 
192
                      connection.Close();
 
193
                  }
 
194
              }
 
195
            ]]&gt;
 
196
          &lt;/code&gt;
 
197
      &lt;/script&gt;
 
198
</pre>
 
199
      </li>
 
200
      <li>
 
201
        <p> Run Visual Basic.NET code that writes a message to the build log. </p>
163
202
        <pre class="code">      &lt;script language="VB"&gt;
164
203
          &lt;code&gt;
165
204
            &lt;![CDATA[
208
247
  </pre>
209
248
      </li>
210
249
      <li>
211
 
        <p>Define a custom function and call it using Boo (http://boo.codehaus.org/).</p>
 
250
        <p> Define a custom function and call it using <a href="http://boo.codehaus.org/">Boo</a>. </p>
212
251
        <pre class="code">      &lt;script language="Boo.CodeDom.BooCodeProvider, Boo.CodeDom, Version=1.0.0.0, Culture=neutral, PublicKeyToken=32c39770e9a21a67"
213
252
          failonerror="true"&gt;
214
253
          &lt;code&gt;
226
265
    </ul>
227
266
    <h3>Requirements</h3>
228
267
    <div style="margin-left: 20px;">
229
 
      <b>Assembly:</b> NAnt.DotNetTasks (0.85.1932.0)
 
268
      <b>Assembly:</b> NAnt.DotNetTasks (0.85.2344.0)
230
269
            </div>
231
270
  </body>
232
271
</html>
 
 
b'\\ No newline at end of file'