views:

234

answers:

3

Hi, 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

+1  A: 

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.

Jayden
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?
Regardless, you can write an NAnt extension, then you can do all the coding in C# or VB.NET.
Jayden
See my example. It asks for input from the user in the form of a login dialog box.
Jayden
Thanks jayden,let me just look into it and get back to you.
Jayden,plz hav a look at below answer section .
A: 

Jayden,I had jst gone through the links and it didnt give much as what i needed.i can tell u my idea.I have a error.xml file.My nant scripts should first read the error.xml file and get the .cpp file corresponding to the errors and then this .cpp should be searched in another .txt file which has has the EID and correspdonding mail ID and it should extract the mail ID from this text file and dynamically update the values in ccnet.config file i.e the mailing section addresses

files EID mailID a.cpp E33333 [email protected]

b.cpp E44444 [email protected]


So it shopuld extract the mail ID from this text file based on the EID as inputs.

Thanks GNR

A: 

Hi

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