Logo Questions Linux Laravel Mysql Ubuntu Git Menu
 

Post-Build Event on Run (F5) In Visual Studio?

I have a post-build event set up in Visual Studio 2010. The problem I am having is that the event doesn't run when I use Run (F5) to start debugging--it only seems to run if I explicitly Build (F6).

This seems to happen even when source files have changed (so it must build in order to run).

Is there a setting that controls this behavior?

like image 780
Phil Sandler Avatar asked Dec 15 '10 19:12

Phil Sandler


People also ask

How do I create a post-build event in Visual Studio?

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.

What is Ctrl F5 in Visual Studio?

F5 & Ctrl-F5 F5 is used to start your project in debug mode and Ctrl-F5 is used to start your project without debug mode.

How do I open a build event in Visual Studio?

Go to Solution Explorer and right-click on the project then select Properties then go to the Build Events tab.

How do I run a batch file in post-build event?

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...


1 Answers

Postbuilds are only run after building. So when your build artifacts are up to date, it will not build and postbuilds will not run.

If it even won't run when it has to build, check the following:

In Visual Studio look at Tools -> Options -> Projects and Solutions -> Build an Run.

Is the option "Only build startup projects and dependencies on Run" checked?

Try to uncheck that option.

What is the value of the option "On Run, when projects are out of date"? It should be "Prompt to build" or "Always build" to be sure to trigger a build when pressing F5.

like image 138
Jan Avatar answered Nov 15 '22 08:11

Jan