根据 Delphi 的帮助文件, 当我打开对话框以添加构建事件到我的项目选项时,对话框应该显示一个可用于构建事件命令行的宏(占位符)列表。然而,在 Delphi XE 中尝试此操作时,宏列表为空。帮助文件中也没有列出可用的宏(至少我没找到)。
那么,有哪些宏是可用的呢?目前我需要一个用于编译后的完整 .exe
文件路径的宏(后置构建),以及 .dproj
文件的完整路径。但我希望能获得未来参考的完整可用宏列表。
根据 Delphi 的帮助文件, 当我打开对话框以添加构建事件到我的项目选项时,对话框应该显示一个可用于构建事件命令行的宏(占位符)列表。然而,在 Delphi XE 中尝试此操作时,宏列表为空。帮助文件中也没有列出可用的宏(至少我没找到)。
那么,有哪些宏是可用的呢?目前我需要一个用于编译后的完整 .exe
文件路径的宏(后置构建),以及 .dproj
文件的完整路径。但我希望能获得未来参考的完整可用宏列表。
我不得不回到D2010才能列出这张清单:
BDS The environment variable $(BDS)
DEFINES The project's conditional defines
DIR The environment variable $(DIR)
INCLUDEPATH The project's include path
INPUTDIR The input file's directory
INPUTEXT The input file's extension
INPUTFILENAME The input file's name, with extension
INPUTPATH The input file's full path
LOCALCOMMAND Local command entered by user in project manager
OUTPUTDIR The output file's directory
OUTPUTEXT The output file's extension
OUTPUTFILENAME The output file's name, with extension
OUTPUTNAME The output file's name, without extension
OUTPUTPATH The output file's full path
Path The environment variable $(PATH)
PROJECTDIR The project's directory
PROJECTEXT The project's extension
PROJECTFILENAME The project file's name, with extension
PROJECTNAME The project's name
PROJECTPATH The project file's full path
SAVE Save the input file to disk before it's compiled
SystemRoot The environment variable $(SYSTEMROOT)
WINDIR The environment variable $(WINDIR)
我已经安装了Update 1,但仍然看不到它们,不过...
对于输出文件,请使用"$(OUTPUTDIR)$(OUTPUTFILENAME)",对于项目文件,请使用"$(ProjectDir)$(ProjectFileName)"
如果这些宏在IDE中没有显示出来,您可以在C:\WINDOWS\Microsoft.NET\Framework\v2.0.50727\Borland.Delphi.Targets中找到可用的宏列表(来源于Delphi的MSBuild项目级属性是什么?)
在该文件中,我的计算机上有以下区域...
<!-- Build event properties settable in the IDE -->
<ProjectName>$(MSBuildProjectName)</ProjectName>
<ProjectFilename>$(MSBuildProjectFile)</ProjectFilename>
<ProjectExt>$(MSBuildProjectExtension)</ProjectExt>
<ProjectDir>$(MSBuildProjectDirectory)</ProjectDir>
<ProjectPath>$(MSBuildProjectFullPath)</ProjectPath>
<InputPath>@(DelphiCompile->'%(FullPath)')</InputPath>
<InputDir>@(DelphiCompile->'%(RootDir)%(Directory)')</InputDir>
<InputName>@(DelphiCompile->'%(Filename)')</InputName>
<InputExt>@(DelphiCompile->'%(Extension)')</InputExt>
<InputFilename>@(DelphiCompile->'%(Filename)%(Extension)')</InputFilename>
<OutputPath>@(_DependencyCheckOutputName->'%(FullPath)')</OutputPath>
<OutputDir>@(_DependencyCheckOutputName->'%(RootDir)%(Directory)')</OutputDir>
<OutputName>@(_DependencyCheckOutputName->'%(Filename)')</OutputName>
<OutputExt>@(_DependencyCheckOutputName->'%(Extension)')</OutputExt>
<OutputFilename>@(_DependencyCheckOutputName->'%(Filename)%(Extension)')</OutputFilename>
HTH