I am trying to use a conditional with an OR in a Post-Build event, but so far, I have had not luck. The following does not work:
if not "$(ConfigurationName)" == "Debug" or not "$(ConfigurationName)" == "Release" (
but this works:
if not "$(ConfigurationName)" == "Debug" (
With the first one, I get an exist code 4.
Another way is to check the bin\debug dir for 'PreBuildEvent. bat' or 'PostBuildEvent. bat' which are the file that Visual Studio creates and run during the build events, if there is an error the files remain in the output dir and you can run them manually and spot the error.
In the Post-build event command line box, specify the syntax of the build event. Add a call statement before all post-build commands that run . bat files. For example, call C:\MyFile.
If you go to the Properties page for your project, you should select the Build Events tab. You can type in the call to your batch file in the Post-build event command line text box. If you want to refer to the batch file using the paths included in the project or solution, you can click on the Edit Post-Build...
PostBuildEvent. This event executes after the build finishes. The following table lists each use-in-build element: XML Element. Description.
It seems like there is no provision for OR/AND in conditionals in Pre-Post Build events, at least according to its lack of documentation over here: http://technet.microsoft.com/en-us/library/bb490920.aspx
You would have to re-write your IF statement to do what you would want to do.
if not "$(ConfigurationName)" == "Debug" (
rem do something
) else if not "$(ConfigurationName)" == "Release" (
rem do the same thing as above
)
Hope that helps, though your conditions don't make sense to me. :-)
If you want to execute some logic in a 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"***))
If you love us? You can donate to us via Paypal or buy me a coffee so we can maintain and grow! Thank you!
Donate Us With