2

Is there anyway by which we can read a value from an .xls file using nant scripts.The nant scripts should ask the input from the user and based on the inputs the nant.build should search the .xls file and when it sees the match,it should copy the corresponding mail ID and echo that mail ID to some other file and that echoed value should be placed in the mail section of the cruise control.NET .

Please get back to me for any more clarifications

Thanks GNR

  • @GNR, this would be a duplicate of http://stackoverflow.com/questions/1021283/what-are-the-command-line-args-for-convert-xls-tool; Please close it. If you want to focus on nant, you could tag the other question so. – nik Jun 20 '09 at 10:22
  • Nik,I dont find any other option other than using nant.So can un please suggest me any other way as its very important buddy. –  Jun 20 '09 at 10:41

2 Answers2

1

You should write an NAnt extension. It is relatively easy to do.

See this tutorial here

As an example project see my question here and here.

Community
  • 1
  • 1
Jayden
  • 2,656
  • 2
  • 26
  • 31
  • Jayden,There is a slight change in the question.I want to write an nant script which reads the value from a text file and echo the value to the user? –  Jun 23 '09 at 05:48
  • Regardless, you can write an NAnt extension, then you can do all the coding in C# or VB.NET. – Jayden Jun 23 '09 at 05:58
  • See my example. It asks for input from the user in the form of a login dialog box. – Jayden Jun 23 '09 at 05:59
  • Thanks jayden,let me just look into it and get back to you. –  Jun 23 '09 at 06:02
  • Jayden,plz hav a look at below answer section . –  Jun 23 '09 at 06:27
0

I'll re-phrase my answer :

"Is there anyway by which we can read a value from an .xls file using nant scripts"

If you are talking about using the 'core' NAnt functionality, which is that funcationality that is provided within the basic installation of NAnt, then I would say "No" or "Not very easily".

You can however extend NAnt using .NET libraries to perform whatever function you want, as long as you can code that function in a .NET language.

So, for you to solve your problems, the steps you need to under-take in my view are :

(a) Write a .NET library with methods that undertake the function(s) you describe

(b) Use the 'extensibility' of NAnt to turn your library in (a) into a custom task you can then call directly from your NAnt script

Obviously, you need to be able to break your problem down so that you can code it for part (a). Once you have done that, part (b) is reasonably trivial, and the tutorial I supplied in the link should easily walk you through this.

Jayden
  • 2,656
  • 2
  • 26
  • 31