126
votes

I've been using using F5 (Start Debugging) for years to build the code (if its out of date), and then debug. This was working on VS 2010 also, however today it just start debugging without a build. Say I do a clean on the project, and then hit F5 instead of building it so it can run it throws an error message saying that the exe doesn't exist to run. How do I make it build first? What could have changed?

10
I had the same issue. It occured from one to the next day and I haven't changed anything in the Options dialog. The answer of Hans solved my issue.jbe
I just ran into this recently, posted a bug report to msft connect, voice your vote to hopefully make them fix it connect.microsoft.com/VisualStudio/feedback/details/626414/…Jason

10 Answers

165
votes

Tools + Options, Projects and Solutions, Build and Run. "On Run, when projects are out of date" = Always build. The one below that = Do not launch.

122
votes

I had this problem and it turned out to be the Configuration Manager. I had recently changed from Debug|Mixed CPU to Debug|Any CPU and the project wasn't set to build under this configuration

22
votes

open your configuration manager and check out if the checkbox in the build column for your startup project is checked. I had the same problem, but the checkbox wasn't active, so i checked it and now it works!

17
votes

Apart from the above also make sure that 'Only build startup projects and dependencies on run' is unchecked (in Tools-->Options-->Projects and Solutions-->Build and Run)

10
votes

I had this problem too. I checked everything suggested to no avail. It turns out my clock on my pc had gotten set forward by about 12 hours, and I was saving to a network drive. The timestamps of the files were out of wack, and VS didn't think it needed to build my project because the files were super up to date.

3
votes

For a while now I have alwasy been confused as to why my laptop (dual core 2ghz, 2Gb ram) compiled my website quicker than my desktop (quad core 3ghz with 16Gb ram). Both have SSD disks. Build options all set correctly (the same, core count = parallel builds) yet the laptop runs the site in a few seconds and the dekstop runs the site in about 30 seconds.

Found an additional option under the "Property pages" of the site, under the Build setting, laptop was set to "No Build" and desktop set to "Build and Run". Only found it after the site ran on the laptop without checking for a compiler error.

Might help someone in the future so thought I would add it to this post

2
votes

Another Point to Check is under solution Property Page -->Configuration Properties --> configuration: make sure all checkboxes under Build Column is check for the project you need to be re-complied.

1
votes

I tried the previous solutions with mixed results. BUT it seems to work for me whenever I go to Build -> Clean Solution

But it's getting annoying having to do that every single time.

1
votes

For me it was happening because of build configuration settings. My visual studio solution has a number of projects which are a mix of C# and C++ projects. Now I realized that for some weird reason, Visual Studio prefers not to build C++ projects by default which is evident by build configuration settings. I noticed it just after adding a new C++ project into the solution. I don't know why VS doesn't follow same approach while adding a new C# project into the solution.

Right click solution file in solution explorer -> Click properties in context menu -> Select Configuration Properties node in left pane -> Select Configuration node. It shows the list of all the projects in the solution. The first project LearnDs is a C++ project. Notice the check box in build column in first row. It is unchecked. This was the reason why Visual Studio 2010 wasn't building my C++ project (on pressing F5) which contained some changes since it was last built successfully.

enter image description here

The moment I checked the corresponding checkbox and saved the build configuration settings for the solution, it worked. Now I see below prompt whenever I press F5 as VS is able to detect that there are some new changes since it was last built. This prompt is because my settings in Tools menu -> Options submenu -> Projects and Solutions node -> Build and Run Node -> "On Run, when projects are out of date" is set to Prompt to build. In case you don't like this prompt then set it to Always build.

enter image description here

1
votes

Tool --> Options --> Project and Solutions.

  1. Set as Always build / Prompt to Build for "On Run, The project is out of date"
  2. Uncheck the check box for "Only build startup projects and dependencies on Run"