代码之家  ›  专栏  ›  技术社区  ›  Winston Chen

蚂蚁中CSC任务的构建问题

  •  1
  • Winston Chen  · 技术社区  · 14 年前

    我有一个使用CSC的Ant构建目标:

    <target name="compile">
        <echo>Starting compiling ServiceLauncher</echo>
        <csc optimize="true" debug="true" warnLevel="1"
                 unsafe="false" targetType="exe" failonerror="true"
                 incremental="false" mainClass = "ServiceLauncher.Launcher"
                 srcdir="ServiceLauncher/Launcher/"
                 outputfile="ServiceLauncher.exe" >
    
            <reference file="libs/log4net.dll"/>
            <define name="RELEASE"/>
        </csc>
    </target>
    

    当我运行它时,会出现以下异常:

    csc失败:java.io.ioexception:无法运行程序“csc”:CreateProcess错误=2,系统找不到指定的文件

    但是,当我手动添加一个空的servicelauncher.exe时,它会毫无例外地运行,但从不正确构建.exe文件。

    如何正确构建这个.NET项目“ServiceLauncher”?

    1 回复  |  直到 14 年前
        1
  •  1
  •   Andrew Cox    14 年前

    我猜是这样的 csc.exe 不在执行路径上。

    从CSC任务的文档中:

    Windows上的csc.exe或任何其他平台上的mcs必须位于执行路径上,除非可执行参数中指定了其他可执行文件或该可执行文件的完整路径。