Logo Questions Linux Laravel Mysql Ubuntu Git Menu
 

Visual Studio 2008 will not edit read only files

So, up until today, when I tried to edit a read only file in VS2008, a dialog popped up giving me three options:

  • Edit in memory
  • Make writable
  • Save a copy

There was also a checkbox which read "Never allow in memory edits".

Suddenly, it has stopped offering these options and simply will not accept any input in the editor window if the file is read only. I have to go into windows explorer and mark the file as not read only then reopen it in VS before I can make any changes. I'm working on a large project, with lots of source controlled files and often need to make local only changes to files, so this is a real PITA.

I'm guessing I must have checked the never allow in memory edits checkbox by mistake.

There is an option in Tools.. Options.. Environment.. Documents which reads:

"Allow editing of read only files, warn when attempt to save"

This checkbox is ticked, and changing its value currently as no effect. I've tried closing and opening studio, restarting my machine etc - all to no avail.

Anyone know how to restore the previous behaviour?

like image 751
Winston Smith Avatar asked Nov 19 '08 17:11

Winston Smith


4 Answers

In case anyone is interested, resetting the following registry entry to 0 will restore the previous behaviour:

HKCU\Sofware\Microsoft\Visual Studio\9.0\Source Control\UncontrolledInMemoryEditDialogSuppressed
like image 91
Winston Smith Avatar answered Oct 03 '22 07:10

Winston Smith


I did the same thing in Visual Studio 2010. The dialog box is not completely clear in the wording. The problem (and Winston's solution) is the same in Visual Studio 2010. So set this to 0 in the registry:

HKEY_CURRENT_USER\Software\Microsoft\Visual Studio\10.0\Source Control\UncontrolledInMemoryEditDialogSuppressed

like image 30
T.J.Kjaer Avatar answered Oct 03 '22 07:10

T.J.Kjaer


There appear to be other registry variables in play, in the same registry location...

As before, go to HKEY_CURRENT_USER\Software\Microsoft\Visual Studio\10.0\Source Control\

And reset all three of:

  • AllowUncontrolledInMemoryEditing
  • AllowInMemoryEditing
  • UncontrolledInMemoryEditDialogSuppressed

back to zero.

(That seems to have taken my own compiler all the way back to "factory default" behaviour.)

like image 41
garryw Avatar answered Oct 03 '22 07:10

garryw


I just had the same problem today and found the selected source control in Tools->Options->Source Control had gotten changed. So... you might want to verify that your selected source control system is what you expect it to be.

like image 27
Paul Matovich Avatar answered Oct 03 '22 06:10

Paul Matovich