【问题标题】:Build event macros in Delphi XE在 Delphi XE 中构建事件宏
【发布时间】:2011-07-28 20:52:50
【问题描述】:

According to Delphi's help file,当我打开对话框以将构建事件添加到我的项目选项时,对话框应显示我可以在命令行上用于构建事件的宏(占位符)列表。当我在 Delphi XE 中尝试这个时,宏列表是空的。帮助文件也没有说明哪些宏可用(我可以找到)。

那么,哪些宏可用?现在我需要一个宏来获取编译后的.exe 文件(构建后)的完整路径,以及.dproj 文件的完整路径。但我想要一份完整的可用宏列表以供将来参考。

【问题讨论】:

    标签: delphi build delphi-xe


    【解决方案1】:

    对于初学者,我认为您想要的是 $(PROJECTPATH),它将是 DPROJ 文件的全名,包括其路径。

    这是 RAD XE 中的一个错误。我也见过这个。它在更新 1 上消失了。等等。我的意思是,这是更新 1 中的回归,而不是 RTM。

    这是 Delphi 2009 的屏幕截图:

    【讨论】:

      【解决方案2】:

      我安装了 Update 1,但仍然看不到它们,但是...

      对于输出文件,使用“$(OUTPUTDIR)$(OUTPUTFILENAME)” 并且项目文件使用“$(ProjectDir)$(ProjectFileName)”

      您可以在 C:\WINDOWS\Microsoft.NET\Framework\v2.0.50727\Borland.Delphi.Targets 中找到可用宏的列表(如果它们没有显示在 IDE 中)(来自 @987654321 @)

      该文件里面是我机器上的以下区域...

      <!-- 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

      【讨论】:

      • 我认为您不需要同时使用 ProjectDir 和 ProjectFilename,您可以使用更简单的 PROJECTPATH。它为您结合了这两者。
      【解决方案3】:

      我必须回到 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)
      

      【讨论】:

      • 谢谢。像这样的东西应该在文档中,即使应用程序本身应该显示列表。
      • @Jan:感谢您修复格式。我似乎无法完全正确。 :)
      • @Ken:诀窍是使用空格而不是制表符来排列第二列。
      • @Jan:谢谢。将来我必须牢记这一点。 (没有办法从IDE的对话框中复制和粘贴,所以我不得不在记事本中输入所有内容,复制到剪贴板,切换回FireFox,然后将其粘贴到答案中。我想到了对话框的屏幕截图,但是您无法调整底部宏列表的大小,因此它会拍摄几张图片。)
      • @Ken:别这么快就让步。 :-) 打开构建事件对话框并使其变高。启动EDA,切换到“修改窗口”选项卡,将窗口选择器拖到“宏”组框,增加DY。
      猜你喜欢
      • 2011-05-25
      • 2014-08-15
      • 1970-01-01
      • 1970-01-01
      • 2012-11-05
      • 1970-01-01
      • 1970-01-01
      • 1970-01-01
      • 1970-01-01
      相关资源
      最近更新 更多