Page 1 of 1

Conditional Build Events possible in the Project Options/Settings?

Posted: Thu Apr 28, 2022 2:08 pm
by BartWilson
I haven't seen in the forum any mention of the question I have:

Is it possible to create conditional Build Events in the project Settings or do these dialogs only allow for calling commands? I'm asking this as I've been adding a couple of items do the Pre-Compress and Post-Compress events in which I realized I don't want the items to run if my program is still in developmental phase, only for Release.

It seems like I would have to write a custom script (powershell or bat) that accepts a conditional item passed through the miabuild command line. I was hoping to not have to write another script to work around things.

I guess that comes to the second question if the first is no, can the Pre-Compress and Post-Compress Events call powershell or bat scripts?

Re: Conditional Build Events possible in the Project Options/Settings?

Posted: Tue May 03, 2022 6:31 am
by FrancescoT
From build events you can run custom applications, or scripts as an integral part of your build process.

In other words, anything that can be invoked via "command prompt", it can be executed via build events as well.

hope this helps you.

Re: Conditional Build Events possible in the Project Options/Settings?

Posted: Mon May 16, 2022 11:39 am
by BartWilson
Thanks for the confirmation. It took a bit for me to get a powershell script command line call to work. There is definitely some funny business about spaces in arguments and also the way you have to quote things in the arguments for this to work. But I was finally able to get a script to run with the desired outcome.

Re: Conditional Build Events possible in the Project Options/Settings?

Posted: Sat Feb 24, 2024 1:33 pm
by JohnGaver
Interesting discovery.

What were you able to find out about spaces and the quotes that you might be able to potentially share?

Basically was there any divergence from the standard pattern of double quoting any parameters with spaces in them?

Re: Conditional Build Events possible in the Project Options/Settings?

Posted: Wed Mar 13, 2024 4:15 pm
by BartWilson

Code: Select all

C:\Windows\System32\WindowsPowerShell\v1.0\powershell.exe $env:VALUE='"true"'; $env:VALUE2='"#VALUE2#"'; $env:VALUE3='"#VALUE3#"'; . """#PROJDIR#\..\PowerShell.ps1""" arg """#PROJDIR#\somefile.ext"""


You can see there are different level of quotes that I had to add when trying to run a powershell script that exists in the PROJDIR