Hello Sunil,
I assume you are working with a <script> task.
See the example (iii) at
http://nant.sourceforge.net/nightly/latest/help/tasks/script.html
You would include there the System.Xml.dll
<script language="C#" >
<references>
<include name="System.Xml.dll" />
</references>
<imports>
<import namespace="System.Xml" />
</imports>
<code>
<![CDATA[
.... Your code
]]>
</code>
</script>
All the best,
Timotheus
On 14 March 2012 00:44, Sunil <[email protected]> wrote:
> How do o solve this?
>
> Sent from my iPhone
>
> On Mar 10, 2012, at 3:20 AM, [email protected] wrote:
>
>> Hey Ryan, Sunil,
>>
>> This is probably the result of a change we introduced in NAnt 0.90-alpha1.
>> As of that release, only NAnt.Core and mscorlib are referenced by default in
>> the <script> task.
>>
>> Regards,
>> Gert
>>
>> ----- Oorspronkelijk e-mail -----
>> Van: "Ryan Boggs" <[email protected]>
>> Aan: "Sunil Singh" <[email protected]>
>> Cc: [email protected]
>> Verzonden: Zaterdag 10 maart 2012 05:26:23
>> Onderwerp: Re: [NAnt-users] Unable to use latest nant 0.91
>>
>> Hi,
>>
>> I don't know what exactly is in your build file but are you including
>> a reference to System.Xml.dll in your build?
>>
>> Thanks,
>> Ryan
>>
>> On Fri, Mar 9, 2012 at 8:03 PM, Sunil Singh <[email protected]> wrote:
>>> Hi All,
>>> I recemtly tried to use nant 0.91 to do build on windows 2003 server
>>> but got following error. I tried on multiple machine but same issue.
>>> I have ,net 4.0 installed ..
>>>
>>> Am i missing anything.??
>>>
>>> NAnt 0.91 (Build 0.91.4312.0; release; 10/22/2011)
>>>
>>> Copyright (C) 2001-2011 Gerry Shaw
>>>
>>> http://nant.sourceforge.net
>>>
>>>
>>>
>>> Buildfile: file:///G:/TFS/BetaEngine/Deployment/Scripts/build.xml
>>>
>>> Target framework: Microsoft .NET Framework 4.0
>>>
>>> Target(s) specified: createDrop
>>>
>>>
>>>
>>>
>>>
>>> OnFailure:
>>>
>>>
>>>
>>> [echo] Build failed at 03/08/2012 19:50:56
>>>
>>>
>>>
>>> BUILD FAILED
>>>
>>>
>>>
>>> Compilation failed:
>>>
>>> c:\Documents and Settings\sysibdpribuilduserd\Local
>>> Settings\Temp\1\fohsvsqg.0.cs(17,14) : error CS0234: The type or
>>> namespace name 'Xml' does not
>>>
>>> //------------------------------------------------------------------------------
>>>
>>> // <auto-generated>
>>>
>>> // This code was generated by a tool.
>>>
>>> // Runtime Version:4.0.30319.488
>>>
>>> //
>>>
>>> // Changes to this file may cause incorrect behavior and will be lost if
>>>
>>> // the code is regenerated.
>>>
>>> // </auto-generated>
>>>
>>> //------------------------------------------------------------------------------
>>>
>>>
>>>
>>> using NAnt.Core;
>>>
>>> using NAnt.Core.Attributes;
>>>
>>> using System;
>>>
>>> using System.Collections;
>>>
>>> using System.IO;
>>>
>>> using System.Text;
>>>
>>> using System.Xml;
>>>
>>>
>>>
>>>
>>>
>>>
>>>
>>> [FunctionSet("DeployUtils", "DeployUtils")]
>>>
>>> public class nantddaf318abf45436db87f93cbfb2ae9ea :
>>> NAnt.Core.FunctionSetBase {
>>>
>>>
>>>
>>>
>>>
>>> [TaskName("fixXpath")]
>>>
>>> public class FixXPathTask : Task {
>>>
>>>
>>>
>>> private string _srcFile;
>>>
>>> private string _xpath;
>>>
>>> private string _attribute;
>>>
>>> private string _value;
>>>
>>> private string _ns;
>>>
>>>
>>>
>>> private string _execStatus;
>>>
>>>
>>>
>>> [TaskAttribute("file", Required=true)]
>>>
>>> public string SrcFile {
>>>
>>> get { return _srcFile; }
>>>
>>> set { _srcFile = value; }
>>>
>>> }
>>>
>>>
>>>
>>> [TaskAttribute("xpath", Required=true)]
>>>
>>> public string XPath {
>>>
>>> get { return _xpath; }
>>>
>>> set { _xpath = value; }
>>>
>>> }
>>>
>>>
>>>
>>> [TaskAttribute("attribute", Required=true)]
>>>
>>> public string Attribute {
>>>
>>> get { return _attribute; }
>>>
>>> set { _attribute = value; }
>>>
>>> }
>>>
>>>
>>>
>>> [TaskAttribute("value", Required=true)]
>>>
>>> public string Value {
>>>
>>> get { return _value; }
>>>
>>> set { _value = value; }
>>>
>>> }
>>>
>>>
>>>
>>> [TaskAttribute("namespace", Required=false)]
>>>
>>> public string Namespace {
>>>
>>> get { return _ns; }
>>>
>>> set { _ns = value; }
>>>
>>> }
>>>
>>>
>>>
>>>
>>>
>>> protected override void ExecuteTask() {
>>>
>>>
>>>
>>> Console.WriteLine("Fixing " + SrcFile + " "+XPath+ " " + Attribute);
>>>
>>>
>>>
>>> XmlDocument doc = new XmlDocument();
>>>
>>> doc.Load(SrcFile);
>>>
>>>
>>>
>>> XmlNamespaceManager nsmgr = new
>>> XmlNamespaceManager(doc.NameTable);
>>>
>>> if (Namespace != null)
>>>
>>> {
>>>
>>> nsmgr.AddNamespace(String.Empty, Namespace);
>>>
>>> }
>>>
>>> XmlNode node = doc.SelectSingleNode(XPath ,nsmgr);
>>>
>>> Console.WriteLine(node == null ? "Node Not Found" : "Node
>>> Found");
>>>
>>> node.Attributes[Attribute].Value = Value;
>>>
>>> XmlWriterSettings settings = new XmlWriterSettings();
>>>
>>> settings.Indent = true;
>>>
>>> XmlWriter xw = XmlWriter.Create(SrcFile, settings);
>>>
>>> doc.WriteContentTo(xw);
>>>
>>> xw.Close();
>>>
>>> }
>>>
>>> }
>>>
>>>
>>>
>>> [TaskName("fixAllXpath")]
>>>
>>> public class FixAllXPathTask : FixXPathTask {
>>>
>>>
>>>
>>> private string _srcFile;
>>>
>>> private string _xpath;
>>>
>>> private string _attribute;
>>>
>>> private string _value;
>>>
>>> private string _ns;
>>>
>>>
>>>
>>> private string _execStatus;
>>>
>>>
>>>
>>> [TaskAttribute("file", Required=true)]
>>>
>>> public string SrcFile {
>>>
>>> get { return _srcFile; }
>>>
>>> set { _srcFile = value; }
>>>
>>> }
>>>
>>>
>>>
>>> [TaskAttribute("xpath", Required=true)]
>>>
>>> public string XPath {
>>>
>>> get { return _xpath; }
>>>
>>> set { _xpath = value; }
>>>
>>> }
>>>
>>>
>>>
>>> [TaskAttribute("attribute", Required=true)]
>>>
>>> public string Attribute {
>>>
>>> get { return _attribute; }
>>>
>>> set { _attribute = value; }
>>>
>>> }
>>>
>>>
>>>
>>> [TaskAttribute("value", Required=true)]
>>>
>>> public string Value {
>>>
>>> get { return _value; }
>>>
>>> set { _value = value; }
>>>
>>> }
>>>
>>>
>>>
>>> [TaskAttribute("namespace", Required=false)]
>>>
>>> public string Namespace {
>>>
>>> get { return _ns; }
>>>
>>> set { _ns = value; }
>>>
>>> }
>>>
>>>
>>>
>>>
>>>
>>> protected override void ExecuteTask()
>>>
>>> {
>>>
>>>
>>>
>>> Console.WriteLine("Fixing " + SrcFile + " "+XPath+ " " + Attribute);
>>>
>>> XmlDocument doc = new XmlDocument();
>>>
>>> doc.Load(SrcFile);
>>>
>>> XmlNamespaceManager nsmgr = new
>>> XmlNamespaceManager(doc.NameTable);
>>>
>>> if (Namespace != null)
>>>
>>> {
>>>
>>> nsmgr.AddNamespace("def", Namespace);
>>>
>>> }
>>>
>>> XmlNodeList nodeList = doc.SelectNodes(XPath ,nsmgr);
>>>
>>> Console.WriteLine("Found Nodes "+nodeList.Count);
>>>
>>> foreach(XmlNode node in nodeList)
>>>
>>> {
>>>
>>> node.Attributes[Attribute].Value = Value;
>>>
>>> }
>>>
>>>
>>>
>>>
>>>
>>> XmlWriterSettings settings = new XmlWriterSettings();
>>>
>>> settings.Indent = true;
>>>
>>> XmlWriter xw = XmlWriter.Create(SrcFile, settings);
>>>
>>> doc.WriteContentTo(xw);
>>>
>>> xw.Close();
>>>
>>> }
>>>
>>> }
>>>
>>>
>>>
>>>
>>>
>>> public nantddaf318abf45436db87f93cbfb2ae9ea(NAnt.Core.Project
>>> project, NAnt.Core.PropertyDictionary propDict) :
>>>
>>> base(project, propDict) {
>>>
>>> }
>>>
>>> }
>>>
>>>
>>>
>>>
>>>
>>> Total time: 0.4 seconds.
>>>
>>> ------------------------------------------------------------------------------
>>> Virtualization & Cloud Management Using Capacity Planning
>>> Cloud computing makes use of virtualization - but cloud computing
>>> also focuses on allowing computing to be delivered as a service.
>>> http://www.accelacomm.com/jaw/sfnl/114/51521223/
>>> _______________________________________________
>>> NAnt-users mailing list
>>> [email protected]
>>> https://lists.sourceforge.net/lists/listinfo/nant-users
>>
>> ------------------------------------------------------------------------------
>> Virtualization & Cloud Management Using Capacity Planning
>> Cloud computing makes use of virtualization - but cloud computing
>> also focuses on allowing computing to be delivered as a service.
>> http://www.accelacomm.com/jaw/sfnl/114/51521223/
>> _______________________________________________
>> NAnt-users mailing list
>> [email protected]
>> https://lists.sourceforge.net/lists/listinfo/nant-users
>
> ------------------------------------------------------------------------------
> Keep Your Developer Skills Current with LearnDevNow!
> The most comprehensive online learning library for Microsoft developers
> is just $99.99! Visual Studio, SharePoint, SQL - plus HTML5, CSS3, MVC3,
> Metro Style Apps, more. Free future releases when you subscribe now!
> http://p.sf.net/sfu/learndevnow-d2d
> _______________________________________________
> NAnt-users mailing list
> [email protected]
> https://lists.sourceforge.net/lists/listinfo/nant-users
------------------------------------------------------------------------------
Virtualization & Cloud Management Using Capacity Planning
Cloud computing makes use of virtualization - but cloud computing
also focuses on allowing computing to be delivered as a service.
http://www.accelacomm.com/jaw/sfnl/114/51521223/
_______________________________________________
NAnt-users mailing list
[email protected]
https://lists.sourceforge.net/lists/listinfo/nant-users