Writing directly to the XML (lpi) would work in principle. As soon as I call UpdateLPI, the * .lpi on the disk is changed, looked at with an external editor. But as soon as I press F9 or save Project, the * .lpi is overwritten immediately.
In that sense, this does not help me.
I also tried your first variant, I tried to write a descendant of TLazProject.
But there he does not find CompilerPath + ExecuteBefore.
Too bad that afterwards is not not implemented, that is the most important thing for the AVR programming with Lazarus, which is called there AVRdude with different parameters.
uses
IDEExternToolIntf;
......
procedure TNewLazProject(const Command: string; ScanFPCMsgs: boolean);
begin
CompilerPath:='';
ExecuteBefore.Command:=Command;
if ScanFPCMsgs then
ExecuteBefore.Parsers.Text:=SubToolFPC+LineEnding+SubToolMake
else
ExecuteBefore.Parsers.Clear;
end;