How to execute a post build based on a configuration project

Category: visual studio general


wakefun on Tue, 13 Mar 2018 08:27:34

Dear all,

I have the following post build which need to be executed only during Deploy configuration ( whatever the CPU type) :

if "$(ConfigurationName)"=="Deploy" (XCOPY "$(TargetDir)*" "C:\SoftDev\Release\" /S /Y)
if "$(ConfigurationName)"=="Deploy" (cd C:\SoftDev\\Indus)
if "$(ConfigurationName)"=="Deploy" (gemalto.cmd)

The post build fail all time. If I remove the IF statement all works fine but runs in all configuration which I do not want.

Any idea what could be wrong



Leo Liu-MSFT on Wed, 14 Mar 2018 08:58:28

Hi wakefun,

I test your command in my side with a test demo, all those command are works fine, you can check my result:

So the command should be correct. To troubleshooting this issue, I suggest that you can execute those command one by one, check which command throw the error, then we can narrow down the range of this issue.

Note: Make sure those command can be executed correctly, you should:

1. Manually create the folder C:\SoftDev\Indus and set the gemalto.cmd into that folder.

2. Make sure your gemalto.cmd can be executed without any error, you can test it with one command line in the cmd file, like me, just set one command echo "This is test demo!" in the cmd.

MSDN Community Support Please remember to click Mark as Answer. This can be beneficial to other community members reading this thread. If you have any compliments or complaints to MSDN Support, feel free to contact