Can we execute the .bat file on the post build event command line in visual studio?

Is it possible to execute a .bat file on the post build command line in visual studio?

+50
build-automation visual-studio-2008 visual-studio visual-studio-2005
Sep 29 '09 at 9:01
source share
3 answers

Of course, here is an example:

call "$(SolutionDir)scripts\copyifnewer.bat" "$(SolutionDir)libs\RLPL.Services.CertificateValidator.Basic.dll" "$(TargetDir)RLPL.Services.CertificateValidator.Basic.dll" call "$(SolutionDir)scripts\copyifnewer.bat" "$(SolutionDir)libs\RLPL.Services.CertificateValidator.Common.dll" "$(TargetDir)RLPL.Services.CertificateValidator.Common.dll" 

Just be aware of two possible problems that may arise:

  1. enclosing double quotes (see how each part is surrounded by a " sign)

  2. if you want to call 2 or more batch files, make sure you use the call command otherwise you will have a problem finding why the second bat is not doing its job

+94
Jul 23 '10 at 16:25
source share

Yes, adding a call to it in the event editor after the build.

If you go to the "Properties" page for your project, you should select the "Events" tab. You can enter the call into the batch file in the command line text box of the Post-build event.

If you want to access the batch file using the paths included in the project or solution, you can click the "Edit post-assembly" button. This will open the post-build event command line dialog box.

This dialog box has a Macros → button that you can click. It will show you all the available macros that you can use to refer to folders and files in your solution.

When you select one of these macros, you can use the "Insert" button to paste them into your script.

+30
Sep 29 '09 at 9:05
source share

In addition to calling the .bat file, you can enter command commands (i.e. the usual commands available from the Windows console - cmd.exe) directly into the Pre-build / Post-build fields. This may be preferable, as it means that you do not need to maintain the batch file separately, since all your commands will be part of the project.

+8
Sep 30 '09 at 9:03
source share



All Articles