This looks like it will work just fine.  I have a custom Nant extensions 
project and will add this in that DLL.


Ken Parrish
Gomez, Inc.

From: Michael Pento [mailto:mpe...@metratech.com] 
Sent: Tuesday, November 03, 2009 12:52 PM
To: Parrish, Ken; nant-users@lists.sourceforge.net
Subject: RE: [NAnt-users] Input prompting ...

Good Afternoon Folks,

I was just playing around with this and I was able to do it with a C# script 
function in a target:

<target name="getUserInput">
       <script language="C#" prefix="build">
                        public static string getInput()
                                    Console.WriteLine("Enter a string: ");
                                    string s = Console.ReadLine();
                                    return s.ToString();
            <property name="_str" value="${build::getInput()}" />
            <echo message="----> Input String: ${_str}" />

Executing this on my machine produces the following output:

C:\>nant -f:test.build getUserInput
NAnt 0.86 (Build 0.86.2898.0; beta1; 12/8/2007)
Copyright (C) 2001-2007 Gerry Shaw

Buildfile: file:///C:/test.build
Target framework: Microsoft .NET Framework 3.5
Target(s) specified: getUserInput

[loadtasks] Scanning assembly "NAnt.Contrib.Tasks" for extensions.
[loadtasks] Scanning assembly "broloco.NAntTasks" for extensions.
   [script] Scanning assembly "cb5myvqk" for extensions.


   [script] Scanning assembly "vohtvvkh" for extensions.
Enter a string:
This is a test string!!
     [echo] ----> Input String: This is a test string!!


Total time: 8.4 seconds.

This stores the input into a property and you can do whatever you like with it 
after that.

I hope this helps,

From: Parrish, Ken [mailto:kparr...@gomez.com] 
Sent: Tuesday, November 03, 2009 9:34 AM
To: nant-users@lists.sourceforge.net
Subject: [NAnt-users] Input prompting ...

Nant Users,

Is there a task that can be used to prompt a user for input of a property?  I'd 
like to design some tasks which will prompt the user for input of a property if 
the property was not specified on the command line.  I looked in both Nant and 
NantContrib and didn't see anything.  Am I missing something?

Ken Parrish
Gomez, Inc.

Come build with us! The BlackBerry(R) Developer Conference in SF, CA
is the only developer event you need to attend this year. Jumpstart your
developing skills, take BlackBerry mobile applications to market and stay 
ahead of the curve. Join us from November 9 - 12, 2009. Register now!
NAnt-users mailing list

Reply via email to