I have a rather simple build example below:

<project name="Test" default="build.compress">
   <property name="build.folder" value="Build" />
   <property name="fix.name" value=".\text.txt" />
   <!-- This target compresses the JavaScript files -->
   <target name="build.compress">
       <ifnot test="${file::write-file('.\test.txt', '&lt;%@ Page 
language=&quot;c#&quot; AutoEventWireup=&quot;false&quot;%&gt;&lt;%@ 
Import Namespace=&quot;JobTraQResources&quot;%&gt;')}">
           <fail message='Could not write ScriptScanFix.js.aspx file 
header.' />
       </ifnot>
       <foreach item="File" property="scriptfile">
           <in>
               <items>
                   <include name="${build.folder}\*.js" />
                   <include name="${build.folder}\*.js.aspx" />
                   <include name="${build.folder}\clientscripts\*.js" />
                   <include 
name="${build.folder}\clientscripts\*.js.aspx" />
               </items>
           </in>
           <do>
               <exec program="cscript">
                   <arg value="CompressScript.wsf" />
                   <arg value="-s" />
                   <arg value="-l" />
                   <arg value="2" />
                   <arg value="-ow" />
                   <arg file="${scriptfile}" />
                   <arg file="${scriptfile}" />
               </exec>
               <echo 
message="${file::copy-file-contents('${scriptfile}', '${fix.name}')}" />
           </do>
       </foreach>
   </target>

     <!-- This script starts creating the ScriptScanFix.js.aspx file -->
   <script language="C#" prefix="file" >
       <references>
           <include name="System" />
       </references>
       <imports>
           <import namespace="System.IO" />
           <import namespace="System.Text" />
       </imports>
       <code>
           <![CDATA[
               [Function("write-file")]
               public static bool WriteFile(string FileName, string 
FileContents)
               {
                   try
                   {
                       FileStream Out = new FileStream(FileName, 
FileMode.Append, FileAccess.Write, FileShare.ReadWrite, 8, true);
                       
Out.Write(ASCIIEncoding.ASCII.GetBytes(FileContents + "\r\n"), 0, 
ASCIIEncoding.ASCII.GetByteCount(FileContents + "\r\n"));
                       Out.Close();
                       return(true);
                   }
                   catch (Exception err)
                   {
                       return(false);
                   }
               }
           ]]>
           <![CDATA[
               [Function("copy-file-contents")]
               public static string CopyFileContents(string SourceFile, 
string DestinationFile)
               {
                   try
                   {
                       string FileContents = 
File.OpenText(SourceFile).ReadToEnd();
                       WriteFile(DestinationFile, FileContents);
                       return("true");
                   }
                   catch (Exception err)
                   {
                       return(".NET: " + err.Message);
                   }
               }
           ]]>
       </code>
   </script>
</project>


My main problem comes from the fact that I am trying to do this:

<echo message="${file::copy-file-contents('${scriptfile}', 
'${fix.name}')}" />

Where I call the function copy-file-contents and I want to pass in the 
values of scriptfile and fix.name.  But I can't.  I can't figure out how 
to actually pass in those values and not their name.  Any ideas?





-------------------------------------------------------------------------
Take Surveys. Earn Cash. Influence the Future of IT
Join SourceForge.net's Techsay panel and you'll get the chance to share your
opinions on IT & business topics through brief surveys -- and earn cash
http://www.techsay.com/default.php?page=join.php&p=sourceforge&CID=DEVDEV
_______________________________________________
NAnt-users mailing list
NAnt-users@lists.sourceforge.net
https://lists.sourceforge.net/lists/listinfo/nant-users

Reply via email to