8

In older versions of Visual Studio by pressing CTRL+F5 the C++ project was built and Run after build, automatically. In VS 2015 first you need to build the project and then run the project because CTRL+F5 does not compile the project anymore. How can I make the CTRL+F5 shortcut to do both Build+Run a C++ project?

Mario
  • 13,941
  • 20
  • 54
  • 110

3 Answers3

9

By default, when you press CTRL+F5 Visual Studio asks you if you want to build a changed project:

enter image description here

It looks like you selected Do not show this dialog again and pressed No.

To revert it, change HKEY_CURRENT_USER\Software\Microsoft\VisualStudio\14.0\General\BuildOutOfDateProjects from 1 to 2.

For all possible values see __BUILDOUTOFDATEPROJECTS Enumeration.

Update (thanks to Cody Gray): Instead of editing registry, check the On Run, when projects are out of date option:

enter image description here

Sergey Vlasov
  • 26,641
  • 3
  • 64
  • 66
  • 1
    You don't need to root around in the registry to change this setting. It is right there in the Visual Studio Options dialog. Tools -> Options -> Project and Solutions -> Build and Run. Do consider updating your answer. – Cody Gray - on strike Jan 03 '17 at 11:36
  • Thank you, I looked after that option and I could not find it. – Mario Jan 03 '17 at 13:49
  • The build dialog seems that is disabled by default in VS2015, that's why I never seen it when pressed CTRL+F5 – Mario Jan 03 '17 at 13:55
  • This is nice, but depending on your build system it can take VS a long time to work out whether anything needs to be built or not. For that reason, I prefer to keep this setting on 'never build' so I can quickly deploy the program if I haven't made any changes. It would be nice to have a separate 'build and run' setting to use when you *have* made changes. – John Gowers Mar 12 '21 at 11:13
2

In Visual Studio 2017 all I had to do was

F5

to build and run the project.

Kellen Stuart
  • 7,775
  • 7
  • 59
  • 82
0

Building: Ctrl + F9

Running: Ctrl+ F10

First Build and then Run

pradeexsu
  • 1,029
  • 1
  • 10
  • 27