我的searchversion.exe
文件没有在脚本中运行..为什么会这样?
<project name="nightly_build" default="main" basedir="checkout">
<target name="init">
<property file="initial.properties"/>
<property file="C:/Work/lastestbuild.properties"/>
<tstamp>
<format property="suffix" pattern="yyyyMMddHHmmss"/>
</tstamp>
</target>
<target name="main" depends="init">
<sequential>
<exec executable="C:/Work/Searchversion.exe"/>
...
</sequential>
</target>
</project>
Searchversion.exe
将生成latestbuild.properties
个文件。我没有任何关于Searchversion.exe的参数。
以下是searchversion.exe
的代码:
using System;
using System.Collections.Generic;
using System.Linq;
using System.Text;
using System.IO;
namespace Search
{
class Program
{
static void Main(string[] args)
{
System.Diagnostics.Process p = new System.Diagnostics.Process();
p.StartInfo.FileName = "sslist.exe";
p.StartInfo.Arguments = "-R -H -h sinsscm01.ds.net /mobile";
p.StartInfo.UseShellExecute = false;
p.StartInfo.RedirectStandardOutput = true;
p.StartInfo.RedirectStandardError = true;
p.Start();
string procOutput = p.StandardOutput.ReadToEnd();
string procError = p.StandardError.ReadToEnd();
TextWriter outputlog = new StreamWriter("C:\\Work\\listofsnapshot.txt");
outputlog.Write(procOutput);
outputlog.Close();
string greatestVersionNumber = "";
using (StreamReader sr = new StreamReader("C:\\Work\\listofsnapshot.txt"))
{
while (sr.Peek() >= 0)
{
var line = sr.ReadLine();
var versionNumber = line.Replace(@"6.70_Extensions/6.70.102/ANT_SASE_RELEASE_", "");
if(versionNumber.Length != line.Length)
greatestVersionNumber = versionNumber;
}
}
Console.WriteLine(greatestVersionNumber);
TextWriter latest = new StreamWriter("C:\\Work\\latestbuild.properties");
latest.Write("Version_Number=" + greatestVersionNumber);
latest.Close();
}
}
}
sslist.exe
获取我的版本控制软件中找到的快照列表,我将获得最大版本号并将其另存为文本(latestbuild.properties
)
答案 0 :(得分:0)
你的剧本中的两件事看起来很奇怪。
<sequential>
目标中的<main>
任务。depends
目标的<main>
属性会导致<init>
目标在Searchversion.exe
之前运行。所以,也许它正在运行,为时已晚。假设#2是导致问题的原因,您应该将脚本重构为如下所示:
<project name="nightly_build" default="main" basedir="checkout">
<target name="init">
<exec executable="C:/Work/Searchversion.exe"/>
<property file="initial.properties"/>
<property file="C:/Work/lastestbuild.properties"/>
<tstamp>
<format property="suffix" pattern="yyyyMMddHHmmss"/>
</tstamp>
</target>
<target name="main" depends="init">
...
</target>
</project>