蚂蚁不执行.exe文件 [英] ant not executing .exe file

查看:274
本文介绍了蚂蚁不执行.exe文件的处理方法,对大家解决问题具有一定的参考价值,需要的朋友们下面随着小编来一起学习吧!

问题描述

我的 searchversion.exe 文件未在script..why运行是这样吗?

my searchversion.exe file is not running in the script..why is that so?

<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 will generate latestbuild.properties file. I do not have any arguments for Searchversion.exe.

下面是code为 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

sslist.exe gets a list of snapshots found in my version control software, and i will get the greatest version number and save it as a text (latestbuild.properties)

推荐答案

在你的脚本有两件事看起来很奇怪。

Two things in your script look odd.


  1. 我不认为你需要的&LT;连续&GT; 任务中的&lt;主&GT; 目标。

  2. 你的取决于属性&lt;主&GT; 目标将导致&LT; INIT&GT; 目标 Searchversion.exe 之前运行。所以,也许是越来越来看,只是为时已晚。

  1. I don't think you need the <sequential> task in the <main> target.
  2. The depends attribute of you <main> target will cause the <init> target to run before Searchversion.exe. So, perhaps it is getting run, just too late.

假设#2是你的问题的原因,你应该调整你的脚本是这样的:

Assuming #2 is the cause of your problem you should restructure your script to look like this:

<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>

这篇关于蚂蚁不执行.exe文件的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持IT屋!

查看全文
登录 关闭
扫码关注1秒登录
发送“验证码”获取 | 15天全站免登陆