开发者

Delphi XE build events.. globally?

Starting to make a lot of use out of the build events system in XE, but one thing I noticed is that I'm unable to set up default build events in the default project settings. Is there any 开发者_开发知识库sort of workaround/hack/whatever that would make this possible? I'm looking at CodeGear.Group.Targets and CodeGear.Delphi.Targets in the bin directory, if this is even doable, would that be where I should be looking?

Thanks


Ah ha. Answered my own question. (Is there a delete button somewhere? Lol)

I did some experimenting, added some easy to find pre and post build events (namely launching the registry editor and notepad..)

In Delphi's bin directory there's a file called CodeGear.Delphi.Targets. Inside that, after the import sections, I added:

<PropertyGroup>
     <PreBuildEvent><![CDATA[regedit.exe]]></PreBuildEvent>
     <PostBuildEvent><![CDATA[notepad.exe $(MSBuildProjectFile)]]></PostBuildEvent>
</PropertyGroup>

Restarted the IDE, and a new empty project executed those programs on pre and post build. Note that they don't show up on the project configuration screen though, but you can override them, negating whatever was put in the CodeGear.Delphi.Targets file. Cheap, but it seems to do the trick, and you can still override it if needed on a specific project. (Just make sure to back the original file up of course.)


@Jen Smith: Very clever. And in case someone is interested I've now used your idea to get madExcept to patch the binary exe as part of a command line build without having to customise a specific project..:

Put this after the 'Import' section of CodeGear.Delphi.Targets..

  <PropertyGroup>
    <PostBuildEvent><![CDATA["$(programFilesx86)\madCollection\madExcept\Tools\madExceptPatch.exe" "$(DCC_ExeOutput)$(MSBuildProjectName).exe" "$(MSBuildProjectDirectory)\$(MSBuildProjectName).mes"]]></PostBuildEvent>
  </PropertyGroup>
0

上一篇:

下一篇:

精彩评论

暂无评论...
验证码 换一张
取 消

最新问答

问答排行榜