So, up until today, when I tried to edit a read only file in VS2008, a dialog popped up giving me three options:
所以,直到今天,当我尝试在VS2008中编辑只读文件时,弹出一个对话框,给出了三个选项:
- 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.
突然之间,它已停止提供这些选项,如果文件是只读的,则不会接受编辑器窗口中的任何输入。我必须进入Windows资源管理器并将文件标记为不只读,然后在我可以进行任何更改之前在VS中重新打开它。我正在开发一个大项目,有很多源控制文件,并且经常需要对文件进行本地更改,所以这是一个真正的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?
有谁知道如何恢复以前的行为?
5 个解决方案
#1
14
In case anyone is interested, resetting the following registry entry to 0 will restore the previous behaviour:
如果有人感兴趣,将以下注册表项重置为0将恢复以前的行为:
HKCU\Sofware\Microsoft\Visual Studio\9.0\Source Control\UncontrolledInMemoryEditDialogSuppressed
#2
2
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:
我在Visual Studio 2010中做了同样的事情。对话框在措辞中并不完全清楚。问题(和Winston的解决方案)在Visual Studio 2010中是相同的。因此在注册表中将此设置为0:
HKEY_CURRENT_USER\Software\Microsoft\Visual Studio\10.0\Source Control\UncontrolledInMemoryEditDialogSuppressed
HKEY_CURRENT_USER \ Software \ Microsoft \ Visual Studio \ 10.0 \ Source Control \ UncontrolledInMemoryEditDialogSuppressed
#3
1
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\
和以前一样,转到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.)
(这似乎使我自己的编译器一直回到“出厂默认”行为。)
#4
1
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.
我今天遇到了同样的问题,发现工具 - >选项 - >源代码管理中选定的源代码控件已经改变。所以...您可能想要验证所选的源控制系统是否符合您的预期。
#5
-2
Actually, the most logical thing to do is this:
实际上,最合乎逻辑的做法是:
- If A file is not intended to be edited, mark it read only
- If A file is intended to be edited, mark it writable!
如果不打算编辑A文件,请将其标记为只读
如果要编辑A文件,请将其标记为可写!
This is in part the whole point of the read only attribute.
这部分是只读属性的重点。
If you think I am somehow wrong, sure, down mod me, but everyone else logically should agree with me, because presently, its not overly clear why it is you have the need to use things the wrong way.
如果你认为我在某种程度上是错误的,请确定,但是其他人在逻辑上应该同意我的意见,因为目前,它并不过分清楚为什么你需要以错误的方式使用东西。
Until the explanation is expanded upon, your problem is on par with complaining why, when you delete something, you can't later get it back.
在解释扩展之前,你的问题与抱怨为什么,当你删除某些东西时,你不能在以后得到它。
#1
14
In case anyone is interested, resetting the following registry entry to 0 will restore the previous behaviour:
如果有人感兴趣,将以下注册表项重置为0将恢复以前的行为:
HKCU\Sofware\Microsoft\Visual Studio\9.0\Source Control\UncontrolledInMemoryEditDialogSuppressed
#2
2
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:
我在Visual Studio 2010中做了同样的事情。对话框在措辞中并不完全清楚。问题(和Winston的解决方案)在Visual Studio 2010中是相同的。因此在注册表中将此设置为0:
HKEY_CURRENT_USER\Software\Microsoft\Visual Studio\10.0\Source Control\UncontrolledInMemoryEditDialogSuppressed
HKEY_CURRENT_USER \ Software \ Microsoft \ Visual Studio \ 10.0 \ Source Control \ UncontrolledInMemoryEditDialogSuppressed
#3
1
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\
和以前一样,转到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.)
(这似乎使我自己的编译器一直回到“出厂默认”行为。)
#4
1
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.
我今天遇到了同样的问题,发现工具 - >选项 - >源代码管理中选定的源代码控件已经改变。所以...您可能想要验证所选的源控制系统是否符合您的预期。
#5
-2
Actually, the most logical thing to do is this:
实际上,最合乎逻辑的做法是:
- If A file is not intended to be edited, mark it read only
- If A file is intended to be edited, mark it writable!
如果不打算编辑A文件,请将其标记为只读
如果要编辑A文件,请将其标记为可写!
This is in part the whole point of the read only attribute.
这部分是只读属性的重点。
If you think I am somehow wrong, sure, down mod me, but everyone else logically should agree with me, because presently, its not overly clear why it is you have the need to use things the wrong way.
如果你认为我在某种程度上是错误的,请确定,但是其他人在逻辑上应该同意我的意见,因为目前,它并不过分清楚为什么你需要以错误的方式使用东西。
Until the explanation is expanded upon, your problem is on par with complaining why, when you delete something, you can't later get it back.
在解释扩展之前,你的问题与抱怨为什么,当你删除某些东西时,你不能在以后得到它。