.NET Tips and Tricks

Blog archive

Stop Being Bugged About Changed Files

Every once in a while, you have a file open in one of your Visual Studio tabs and the file is updated on the disk. Unlike when any unopened files/folders in Solution Explorer are changed, Visual Studio notices this change. The result is that you get a dialog telling you that the “file has been modified outside of the editor” and are asked if you “want to reload it?” There are, essentially, two buttons on the dialog: Yes and No.

I have never clicked No. Not once. Not ever.

So, the other day, I took the plunge and turned off this dialog: I shouldn’t ever see that message again. Instead, my changed file will be quietly refreshed. If you also want to get rid of the dialog, first go to the Tools menu and select Options. From the Environment treeview on the left side of the resulting dialog, drill down to the Documents node and, on the right, check the option under “Detect when file is changed.” This will cause Visual Studio to skip the dialog and just reload the changed version of the file.

Depending on which version of Visual Studio you have, that option will be called “Autoload Changes, If Saved” or the more obvious “Reload modified files unless there are unsaved changes.” Either way, as long as you haven’t made changes to the file, the changed file will automatically (and silently) be refreshed in the editor tab. If you’ve made changes to the file and haven’t saved them yet, you’ll get a dialog asking if you want to keep your changes.

Quite frankly, I don’t know why it isn’t the default.

Posted by Peter Vogel on 11/17/2015


comments powered by Disqus

Featured

Subscribe on YouTube