Nant:无法从.include获取当前目录
要总结一下这对我来说并不完全容易...我在磁盘上有此结构:
It's not exactly easy for me to summarize this... I have this structure on disk:
[dir]项目
- [dir] foo
- [file] foo.build
- [dir] foo
- [file] foo.build
- [file] bar.build
文件default.include包含几个属性,这些属性是构建期间使用的目录.例如: 属性名称="build.dir"值="$ {directory :: get-current-directory}".
The file default.include contains a couple of properties which are the directories used during the build. E.g: property name="build.dir" value="${directory::get-current-directory}".
foo.build和bar.build使用其相对路径包含default.include文件: include buildfile =".. \ default.include"
The default.include file is included by foo.build and bar.build using its relative path: include buildfile="..\default.include"
现在的问题是:当我从project \ foo dir运行foo.build时,build.dir的值错误.我需要项目",而我却得到项目\ foo".有没有办法获取.include文件所在的目录?
Now the problem: when I run foo.build from project\foo dir, I get the wrong value for build.dir. I need "project" and I get "project\foo" instead. Is there a way to get the directory in which the .include file exists?
我可以使用%〜dp0在批处理文件中完成此操作
I could do this in a batch file using %~dp0
您可以使用此
<property name="build.dir" value="${project::get-base-directory()}">
,并确保将构建输出路径设置为build.dir
and make sure you set the build output path to be build.dir