How to use the OR operator in a Post-Build event?

I am trying to use a condition with OR in a Post-Build event, but so far I have had no luck. The following does not work:

if not "$(ConfigurationName)" == "Debug" or not "$(ConfigurationName)" == "Release" (

but it works:

if not "$(ConfigurationName)" == "Debug" (

With the first, I get the existing code 4.

+6
source share
2 answers

It seems that there are no conditions for OR / AND in conditional expressions in Pre-Post Build events, at least due to the lack of documentation here: http://technet.microsoft.com/en-us/library/bb490920.aspx

You will need to re-write the IF statement to do what you would like to do.

 if not "$(ConfigurationName)" == "Debug" ( rem do something ) else if not "$(ConfigurationName)" == "Release" ( rem do the same thing as above ) 

I hope this helps, although your conditions do not make sense to me. :-)

+7
source

If you want to execute some logic in the Post-Build event, where the ConfigurationName is not β€œDebug” or β€œRelease”, try the following:

if not "$(ConfigurationName)" == "Debug" (if not "$(ConfigurationName)" == "Release" (***ADD LOGIC HERE - ConfigurationName is not "Debug" or "Release"***))

+1
source

All Articles