Logo Questions Linux Laravel Mysql Ubuntu Git Menu
 

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

like image 205
Jen Smith Avatar asked Dec 15 '10 14:12

Jen Smith


1 Answers

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.)

like image 82
Jen Smith Avatar answered Sep 22 '22 02:09

Jen Smith