Hi,
(below all directory names are replaced with (LT: took out the name) which is the same dir on my local drive)
I get an error running the following:
<target name="test">
<echo message="executing target 'test'"/>
<nant buildfile="(LT: took out the name)\globals.build"/>
<nant buildfile="(LT: took out the name)\globals.build"/>
</target>
The buidlfile globals.build contains the following <script> task:
<script language="VB">
<code>
<![CDATA[
'Custom task: send contents of a file to stdout.
<TaskName("viewfile")> _
public class ViewfileTask : Inherits Task
private fName as String
<TaskAttribute("file")> _
Public Property FileName() As String
Get
Return fName
End Get
Set(ByVal Value As String)
fName = Value
End Set
End Property
#region "Override implementation of Task"
protected Overrides sub ExecuteTask()
'Put the file out to console
Dim sr As System.IO.StreamReader
try
sr = New System.IO.StreamReader(fName)
Dim line As String = sr.ReadLine()
While (not line is Nothing)
System.Console.WriteLine(line)
line = sr.ReadLine()
End While
finally
if (not sr is Nothing) then sr.Close()
end try
end sub
#end region
end class
'Custom task: writes a string to a file.
<TaskName("writefile")> _
public class WritefileTask : Inherits Task
private fName as String
private val as String
<TaskAttribute("file")> _
Public Property FileName() As String
Get
Return fName
End Get
Set(ByVal Value As String)
fName = Value
End Set
End Property
<TaskAttribute("value")> _
Public Property MyValue() As String
Get
Return val
End Get
Set(ByVal Value As String)
val = Value
End Set
End Property
#region "Override implementation of Task"
protected Overrides sub ExecuteTask()
'Write value to the file
Dim sw As System.IO.StreamWriter
try
sw = New System.IO.StreamWriter(fName, false)
sw.Write(val)
finally
if (not sw is Nothing) then
sw.Flush()
sw.Close()
end if
end try
end sub
#end region
end class
]]>
</code>
</script>
[nant] (LT: took out the name)\globals.build
Buildfile: (LT: took out the name)/globals.build
Target framework: Microsoft .NET Framework 1.1
Target(s) specified: displaySettings
[script] Scanning assembly "zseh1fd7" for extensions.
BUILD SUCCEEDED - 1 non-fatal error(s), 0 warning(s)
Total time: 0.4 seconds.
[nant] (LT: took out the name)\globals.build
Buildfile: (LT: took out the name)/globals.build
Target framework: Microsoft .NET Framework 1.1
Target(s) specified: displaySettings
[script] Scanning assembly "ihrnqord" for extensions.
[script] Failure scanning "nantd46b8ef117b8454387bae9a13b2422e6+ViewfileTask, ihrnqord, Version=0.0.0.0, Culture=neutral, Pub
licKeyToken=null" for tasks.
BUILD FAILED - 2 non-fatal error(s), 0 warning(s)
INTERNAL ERROR
System.ArgumentNullException: Value cannot be null.
Parameter name: element
at System.Attribute.GetCustomAttributes(MemberInfo element, Type type, Boolean inherit)
at System.Attribute.GetCustomAttribute(MemberInfo element, Type attributeType, Boolean inherit)
at NAnt.Core.TaskBuilder..ctor(String className, String assemblyFileName)
at NAnt.Core.TypeFactory.ScanTypeForTasks(Type type, Task task)
at NAnt.Core.TypeFactory.ScanAssembly(Assembly assembly, Task task)
at NAnt.DotNet.Tasks.ScriptTask.ExecuteTask()
at NAnt.Core.Task.Execute()
at NAnt.Core.Project.InitializeProjectDocument(XmlDocument doc)
at NAnt.Core.Project.Execute()
at NAnt.Core.Project.Run()
Please send bug report to [EMAIL PROTECTED]
Total time: 0.4 seconds.
Any ideas?
Thanks,
Leonid Tomilchik
Capco
t: + 1 212 284 8715
m: + 1 646 479 0323
e: [EMAIL PROTECTED]
w: www.capco.com
************************************************************************ The information in this email is confidential and is intended solely for the addressee(s). Access to this email by anyone else is unauthorized. If you are not an intended recipient, please notify the sender of this email immediately. You should not copy, use or disseminate the information contained in the email. Any views expressed in this message are those of the individual sender, except where the sender specifically states them to be the views of Capco. http://www.capco.com/ ************************************************************************ |