Lionel,
You can use the <get> task for this purpose.
Note, you need to use the <imports> child element to define namespace imports.
Some examples are available here:
http://nant.sourceforge.net/release/latest/help/tasks/script.html
Regards,
Gert
From: Lionel Morrison
Sent: Wednesday, March 17, 2010 4:12 PM
To: nant-users@lists.sourceforge.net
Subject: [NAnt-users] WebRequest
I'm trying to read in a txt file from a website
(http://menumax.com/svn_info.txt) . As it is I can't find a task that will
allow me to call a URL so I thought I would use C# code block.
My question is how do I get NAnt to include the System.Net class? I keep
getting the follow error
Invalid token 'using' in class, struct, or interface member declaration
Below is my code block. Is it simply that I have the using statement in the
wrong place and if so where should I be putting it?
<script language="C#" prefix="lifeware">
<code>
<![CDATA[
using System.Net;
[Function("webrequest")]
public static string webRequest() {
WebRequest request =
WebRequest.Create("http://menumax.com/svn_info.txt");
return "blablabla";
}
]]>
</code>
</script>
Lionel Morrison | Build and Release Engineer | Lifeware TEK
Office: (802) 552-4465 | Cell: (386) 336-7709
Email: lmorri...@lifeware.com
***** CONFIDENTIALITY NOTICE - PLEASE READ FIRST *****
This e-mail message (and all attachments, if any) is intended only for the use
of the individual or the authorized representative of the entity to which it is
addressed, and may contain information which is confidential and protected from
disclosure by law as proprietary information, legally privileged or otherwise.
If you are not the intended recipient, you are hereby notified that you are not
to read the contents and any use, disclosure, distribution or copying of the
transmitted material is strictly prohibited. If you have received this e-mail
message in error, please immediately contact the sender to confirm the deletion
or destruction of this message and all copies.
--------------------------------------------------------------------------------
------------------------------------------------------------------------------
Download Intel® Parallel Studio Eval
Try the new software tools for yourself. Speed compiling, find bugs
proactively, and fine-tune applications for parallel performance.
See why Intel Parallel Studio got high marks during beta.
http://p.sf.net/sfu/intel-sw-dev
--------------------------------------------------------------------------------
_______________________________________________
NAnt-users mailing list
NAnt-users@lists.sourceforge.net
https://lists.sourceforge.net/lists/listinfo/nant-users
------------------------------------------------------------------------------
Download Intel® Parallel Studio Eval
Try the new software tools for yourself. Speed compiling, find bugs
proactively, and fine-tune applications for parallel performance.
See why Intel Parallel Studio got high marks during beta.
http://p.sf.net/sfu/intel-sw-dev
_______________________________________________
NAnt-users mailing list
NAnt-users@lists.sourceforge.net
https://lists.sourceforge.net/lists/listinfo/nant-users