This works fine when the TARGETCOMPUTER environment variable is defined with something like root@usbgadget.munts.net:. and it fails if TARGETCOMPUTER is undefined, as expected.
Is there some way to define a default value for TARGETCOMPUTER? I have tried variations of the following, without success:
I’m afraid this is not supported currently, no. I’ll log a feature request. In the mean time, yu could check if the variable is empty on the script level?
I would also recommend that an undefined property be delivered to the PostBuild script as the empty string “” instead of e.g. the unexpected and unexpanded “$(TARGETCOMPUTER)”. Between the latter behavior and the broken dollar-sign escaping, I had a dickens of a time figuring in the PostBuild script whether a property has been initialized or not. I finally realized the following test works for this purpose:
if not “$(MYPROPERTY)” == “$(myproperty)” echo Unitialized
Another anomaly I noticed is that <PostBuild Platform=“PowerShell”> invokes cmd.exe rather than PowerShell.
This seems already fixed now that I;ve switched EBuild over to sue the variable processing logic in Elements RTL, rather than it’s own (older and now obsolete) copy); seems I addressed that issue back when implementing it for Elements RTL, but EBuild just never got switched over.
Reasonable request. I tinker in other places where variables get replaced this is a bad idea, but for the scripts, it makes sense. Fixed.
This one is odd, as the code, on dry review for it, looks rather straightforward and I cannot see how this would fail (or fall back to cmd); I’ll need to try and reproduce this myself later when I’m near a Windows VM.
its quite literally (and yes, s has to be lowercase or it’d not get there) doing:
if s = "powershell" then begin
var lExe := Path.Combine(System.Environment.GetFolderPath(System.Environment.SpecialFolder.System), "PowerShell.exe");
...
end
else begin
var lExe := Path.Combine(System.Environment.GetFolderPath(System.Environment.SpecialFolder.System), "cmd.exe");
...