Why doesn't F5 rebuild project before execution in Visual Studio?

Visual StudioVisual Studio-2010Build

Visual Studio Problem Overview


If I press F5, my project runs but it doesn't "see" any of the changes that I made. I need to manually (re)build before pressing F5 for it to work.

It worked well previously. Any idea what I need to change?

Visual Studio Solutions


Solution 1 - Visual Studio

Also :

  • Right Click on the solution in the solution explorer.

  • Click on "Properties".

  • Navigate to configuration Properties -> Configuration on the left side of the window.

  • Make sur the "Build" checkbox is checked on the line of your project.

Solution 2 - Visual Studio

Is it possible that you've reconfigured your "Build and Run" settings to "Never build"?

To check, follow these steps:

  1. From the Visual Studio IDE, open the "Tools" menu, and click "Options".
  2. Expand the "Projects and Solutions" header on the left.
  3. Click the "Build and Run" item.
  4. In the combo box labeled "On Run, when projects are out of date", ensure that you have the "Always build" option selected.

   Selecting Always build in VS Options dialog

Solution 3 - Visual Studio

Another reason (which I had) could be dependencies.

In Solution Explorer, right click the Startup Project - Build Dependencies - Project Dependencies.

If the project you are working on is not set as a dependency of the Startup project then it won't get Built when you F5 / run.

Solution 4 - Visual Studio

Ok, for some reason all of the above solutions do not work for me, so I made a Pre-Build event (Right click project -> Properties -> Build Events) where I delete the bin and obj folder before building.

Solution 5 - Visual Studio

I am new to C# and Visual Studio but i found that going to Build -> Clean Project also worked for me, if you have already tried to select "Always build" option and it didn't work.

Attributions

All content for this solution is sourced from the original question on Stackoverflow.

The content on this page is licensed under the Attribution-ShareAlike 4.0 International (CC BY-SA 4.0) license.

Content TypeOriginal AuthorOriginal Content on Stackoverflow
QuestionMaciejView Question on Stackoverflow
Solution 1 - Visual StudiofranssuView Answer on Stackoverflow
Solution 2 - Visual StudioCody GrayView Answer on Stackoverflow
Solution 3 - Visual StudioJon RobertsView Answer on Stackoverflow
Solution 4 - Visual StudioikwillemView Answer on Stackoverflow
Solution 5 - Visual StudioMarcos VelásquezView Answer on Stackoverflow