我在Windows7Professional上使用NAnt 0.90。
我正在尝试使用NAnt构建一个CAB文件。NAnt使用执行任务让CabWiz使用inf文件构建CAB文件。构建失败,但是如果我从命令行使用CabWiz而不是NAnt,我可以构建CAB文件。
下面是我的NAnt构建文件的相关部分:
<target name="build Cab Production">
<exec program="C:\Program Files (x86)\Microsoft Visual Studio 9.0\SmartDevices\SDK\SDKTools\cabwiz.exe" commandline="ACSreader2\ACSreader2Setup\Production\ACSreader2_Setup.inf /err cab_build_errors.err"/>
</target>由cab_build_errors.err生成的CabWiz文件包含两个警告和一个非常普遍的错误消息:
Warning: Section [RegKeys] has no data
Warning: Section [DefaultInstall] key "AddReg" - there are no section entries to process
Error: CAB file "ACSreader2\ACSreader2Setup\Production\ACSreader2_Setup.CAB" could not be created当我从命令行构建CAB时,我会得到同样的2个警告,但没有错误。下面是我在命令行中构建它的方法:
"C:\Program Files (x86)\Microsoft Visual Studio 9.0\SmartDevices\SDK\SDKTools\cabwiz.exe" "C:\programming\ACSreader2\ACSreader2\ACSreader2Setup\Production\ACSreader2_Setup.inf" /err cab_build_errors.err更新:
我能够使用以下命令从命令行复制错误:
"C:\Program Files (x86)\Microsoft Visual Studio 9.0\SmartDevices\SDK\SDKTools\cabwiz.exe" "ACSreader2\ACSreader2Setup\Production\ACSreader2_Setup.inf" /err cab_build_errors.err区别在于,我没有指定inf文件的完整路径。是否有一个变量或其他东西可以使NAnt在不显式地在构建脚本中具有完整路径的情况下传递完整路径?只有构建文件的目录才能工作。
发布于 2011-03-19 06:03:10
通过使用NAnt函数目录::get目录(),我从NAnt构建脚本中指定了inf文件的完整路径。最终结果是:
<target name="build Cab Production">
<exec program="C:\Program Files (x86)\Microsoft Visual Studio 9.0\SmartDevices\SDK\SDKTools\cabwiz.exe" commandline="${directory::get-current-directory()}\ACSreader2\ACSreader2Setup\Production\ACSreader2_Setup.inf /err cab_build_errors.err" />
</target>https://stackoverflow.com/questions/5354758
复制相似问题