More info; part of the script I use below : --------------------- <exec program="cmd.exe" commandline="/c cd"/> <foreach item="File" property="filename"> <in> <items refid="projects.all"/> </in> <do> <exec program="cmd.exe" commandline="/c cd"/> <echo message="filename is ${filename}"/> <exec program="cmd.exe" commandline="/c cd"/> <if test="${utils::must-publish-project(filename,'projects.xml')}"> </if> </do> </foreach> ---------------------
The beginning of the must-publish-project function : --------------------- [Function("must-publish-project")] public static bool MustPublishProject(string projectfilename,string xmlprojectsdescriptor) { Log(Level.Info,"Current directory is {0}",Directory.GetCurrentDirectory()); string projectname = Path.GetFileNameWithoutExtension(projectfilename); XmlDocument doc = new XmlDocument(); doc.Load(xmlprojectsdescriptor); --------------------- The output is a bit surprising : --------------------- first cmd /c cd call : [exec] C:\MySource\BuildServer second cmd /c cd call (in the foreach loop) [exec] C:\MySource\BuildServer the echo filename : [echo] filename is c:\MySource\MyCompany.Services.MyPackage\MyCompany.Services.MyService\MyCompany.Services.MyService.csproj third cmd call : [exec] C:\MySource\BuildServer but then, from inside the function : Current directory is c:\MySource\MyCompany.Services.MyPackage\MyCompany.Services.MyService.Test\bin\Release BUILD FAILED - 1 non-fatal error(s), 2 warning(s) C:\MySource\BuildServer\default.build(247,6): Function call failed. Expression: ${utils::must-publish-project(filename,'projects.xml')} ^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^ Could not find file "c:\MySource\MyCompany.Services.MyPackage\MyCompany.Services.MyService.Test\bin\Release\projects.xml". The xml file cannot be loaded properly because the current folder is not what is expected. ------------------------------------------------------- This SF.net email is sponsored by: IT Product Guide on ITManagersJournal Use IT products in your business? Tell us what you think of them. Give us Your Opinions, Get Free ThinkGeek Gift Certificates! Click to find out more http://productguide.itmanagersjournal.com/guidepromo.tmpl _______________________________________________ Nant-users mailing list [EMAIL PROTECTED] https://lists.sourceforge.net/lists/listinfo/nant-users