<?xml version="1.0"?>
<project name="Project" default="build">
<property name="program" value="C:\Program Files (x86)\Microsoft Visual Studio 9.0\VC\vcvarsall.bat" />
<property name="name.proj" value="C:\project\proj.csproj" />
<target name="build">
<exec program="${program}"commandline="\devenv.exe ${name.proj}" />
</target>
</project>
它的输出是......
Error in Script usage:The Correct usage is:C:\Program Files (x86)\Microsoft Visual
Studio 9.0\VC\vcvarsall.bat" [Option], where option= x86,ia64,or x86_ia64.
但是,当我给出x86选项时,它再次出现错误..“/是一个意外的令牌”
请建议做什么。
答案 0 :(得分:1)
你应该这样做:
<exec program="${program}" commandline="x86" />
我不确定您为什么要将devenv.exe作为命令行传递。您可能希望在单独的exec任务中执行此操作
答案 1 :(得分:1)
答案 2 :(得分:0)
以下是从VSS获取最新信息的EXEC样本
<target name="getlatest" >
<property name="path.cmd.exe" value="C:\WINDOWS\system32\CMD.EXE"/>
<property name="path.vss.bat" value="C:\Work\build\DailyBuild\nAnt\VSSGET.bat"/>
<echo>
-----------------------------------------------------------------------------------------------------------------
-----------------------------------------------------------------------------------------------------------------
TASK : GET LATEST FROM VSS
-----------------------------------------------------------------------------------------------------------------
-----------------------------------------------------------------------------------------------------------------
</echo>
<echo message="Task Start at: ${datetime::now()}" />
<loadtasks assembly="nantcontrib-0.85/bin/NAnt.Contrib.Tasks.dll" />
<exec program="${path.cmd.exe}">
<arg value="/C" />
<arg value="${path.vss.bat}" />
</exec>
</target>