If a program’s code contains syntax errors, then by default if you try to run the program Visual Studio displays the following message:
You should pretty much always click No. If you click Yes, an older version of the program runs so you won’t see any of the changes that you recently made and you may incorrectly think the new code works properly. (This is a common beginner mistake.)
To prevent Visual Studio from even asking if you want to run the old version, follow these steps:
- Open the Tools menu and select Options.
- Expand the Options tree to go to Projects and Solutions > Build and Run. On the right, set “On Run, when build or deployment errors occur” to “Do not launch.”
Now if you have syntax errors, Visual Studio displays them in the Error window, doesn’t launch the old version of the program, and doesn’t waste your time with the message box.