0

When I press F5 in Visual Studio 2010, my code does not compile anymore. Instead, it running the most recent compiled code. To compile the code, I have to right click on the program and choose Build and then run

How do I get my program to compile on each run?

magol
  • 6,135
  • 17
  • 65
  • 120
  • Might be related to: http://stackoverflow.com/questions/913054/visual-studio-commands-dont-work-ctrl-f5-doesnt-run-my-application – David Brabant May 15 '12 at 13:14
  • 2
    @Tigran: As he says in the question, it is not that he's getting a compiler error - VS2010 does not even attempt to compile the project, but runs the last compiled version. – Thorsten Dittmar May 15 '12 at 13:16

3 Answers3

3

It is a setting in Visual Studio. Opening the settings dialog, there should be a category "Projects and Solutions" (sorry, I use the German version - not quite sure what the English labels are). In there's another section "Build and Run". The second combo box from the top allows you to adjust what happens when running projects that have been modified.

Another option is the solution properties. There are settings in there where you can configure which project within the solution should be compiled. To get there, right-click the solution, select "Properties", there select "configuration" (?). There's a check box for each project in a list that you need to check to have the project built.

Thorsten Dittmar
  • 55,956
  • 8
  • 91
  • 139
  • +1 The second option was my problem when I had this issue a while back. – Rawling May 15 '12 at 13:20
  • Aah, the problem lay in the "Configuration Properties" for the Solution. The check box for the project was not marked. Thanks for your help :-) – magol May 15 '12 at 13:26
0

Use F6 to build the whole solution, and Shift-F6 to build your current project

Fiona - myaccessible.website
  • 14,481
  • 16
  • 82
  • 117
0

Tools -> Options -> Projects & Solutions -> Build and Run

"On Run, when projects are out of date:" Select "Always Build"

That's it, had it myself, extremely annoying.

M Afifi
  • 4,645
  • 2
  • 28
  • 48