Hi Srini,
 
You can use a script block to execute arbitrary code; for example, the code below prompts for user input, and then stores the result in a property. You can then refer to this property in the "tofile" attribute of the <copy> task to get the effect you want.
 
Regards,
 
Alex
 
 
<?xml version="1.0"?>
<project name="test" default="run">
 <property name="build.test" value=""/>
  
 <target name="run">
  <call target="getUserInput"/>
  <echo message="Value of $build.test is ${build.test}"/>
 </target>
 
 <target name="getUserInput">
  <script language="C#" mainclass="GetInput">
          <code>
            <![CDATA[
                class GetInput
                {
                    public static void ScriptMain(Project project)
                    {
                        System.Console.WriteLine("Please enter the build directory");
      project.Properties["build.test"] = System.Console.ReadLine();
              }
                }
            ]]>
   </code>
  </script>
 </target>
</project>
----- Original Message -----
From: Sreeni
Sent: Friday, September 10, 2004 1:24 PM
Subject: [Nant-users] passing command-line argument while compiling build

Nant Users,
 
I need a urgent help. I'm writing a build script(nant) for a ASP.Net project. I need to output the build based on a user input. Example Staging/Production. If user chooses Staging, then the build should be written to C:\Staging, If user chooses Production, then the build should be written to C:\Production. How can I achieve this? Is there any way to accept user input while compiling build script? I must be able to compare this value inside my script and then direct the build accordingly.
I would appreciate any help.
 
Regards,
Srini.

Reply via email to