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