I'd occationally like to see the actual build event script for debugging purposes. I've tried leading the script with @echo on which should work according to the documentation, but I've yet to see anything other than exe or explicit "echo some text" output in the build output.
Here's my build event:
echo on
cd $(ProjectDir)_dev
PostBuildEvents.bat $(ConfigurationName) $(TargetName)
I do see this text in the output, but nothing from within the .bat file. I also tried added echo on to the top of the batch file but that did not work either.
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...
In the "File System" view (right-click on the project in Solution Explorer->View->File System), add the batch file you want to execute and cmd.exe (C:\Windows\System32\cmd.exe) Open the "Custom Actions" view (right-click on the project in Solution Explorer->View->Custom Actions)
Although the answer will come incredibly late, it may be useful for other people coming here: the only way I have found is also contained in the documentation page, and it's the following:
Modify your project settings to collect more than the default amount of information in the build log. On the Tools menu, click Options. In the Options dialog box, click the Projects and Solutions node and then click the Build and Run node. Then, in the MSBuild project build log file verbosity box, click Detailed.
I was struggling with the same problem. The only way I was able to overcome this was to echo each line, but that was requiring to type everything twice, once for echo and once to execute. So I decided to use variables with echo.
ECHO ON
ECHO C:\myFolder\bin\heat.exe
C:\myFolder\bin\heat.exe
if errorlevel 1 exit 1
a better way with variables
ECHO ON
SET vCmdl="C:\myFolder\bin\heat.exe"
ECHO %vCmdl%
%vCmdl%
if errorlevel 1 exit 1
In this way, I can see each line of the bat file in the Output window and any messages that they produce and if error occurs "exit 1" is received by VS and build FAILS.
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