1.) Create a new Command-Line App in Visual Studio 2019 on Windows
2.) Go to Project → Properties → Build Events
3.) Add the following in the “Post-build event command line:” box
REM Some Line Here
ECHO Something Here
4.) Build the project in Visual Studio - Note that it completes
5.) Note that the Output window contains “Something Here”
6.) Attempt to add the project to Travis, and build
7.) Note the failure
This is actually MsBuild’s issue: for some reason, it uses Git Bash rather than cmd.exe to run the commands.
Perhaps it honors the SHELL envvar. But in Windows, the selected command interpreter is supposed to rather be specified in COMSPEC.
If this is true, you should be able to workaround this issue by unsetting SHELL before running MsBuild or changing its value for the command to point to cmd.exe:
SHELL="$COMSPEC" MsBuild.exe <etc>
If the issue persists, please link to a build because copypasting things here gives incomplete information about a problem.
PreBuildEvent:
/home/travis/build/yfdyh000/AntiDupl/src/AntiDupl/Antidupl.NET/External.cmd /home/travis/build/yfdyh000/AntiDupl/src/AntiDupl/Antidupl.NET
/bin/sh: 2: /tmp/tmp2dc71b1eb54a45d29b7ac8a8682cc83c.exec.cmd: /home/travis/build/yfdyh000/AntiDupl/src/AntiDupl/Antidupl.NET/External.cmd: not found