Menu: Tools -> Options -> Projects and Solutions -> Build and Run
In Tools -> Options -> Projects and Solutions -> Build and Run there is an "Before Building":
The default setting is to save all changes to the solution file and all project files that changed since the last build BUT there are also other options:
Save changes to open documents only-this option will do what it says and save changes to all open documents without any prompt.
Prompt to save all changes-will give you a prompt that gives you a choice about saving changes:
Don't save any changes-this will run the code but not save any of the changes you have made. Generally not a good idea but can be useful in some situations where you are testing many different code scenarios quickly.