visual-studio 在 Visual Studio 2010 中随机禁用编辑 aspx/ascx 文件?

声明:本页面是StackOverFlow热门问题的中英对照翻译,遵循CC BY-SA 4.0协议,如果您需要使用它,必须同样遵循CC BY-SA许可,注明原文地址和作者信息,同时你必须将它归于原作者(不是我):StackOverFlow 原文地址: http://stackoverflow.com/questions/3450617/
Warning: these are provided under cc-by-sa 4.0 license. You are free to use/share it, But you must attribute it to the original authors (not me): StackOverFlow

提示:将鼠标放在中文语句上可以显示对应的英文。显示中英文
时间:2020-10-22 12:20:22  来源:igfitidea点击:

Editing aspx/ascx files randomly disabled in Visual Studio 2010?

asp.netvisual-studio-2010visual-studio

提问by Herb Caudill

I'll be debugging a site in Visual Studio 2010 and editing an *.aspxor *.ascxfile, and without warning, it will lock up so that I can't edit it. There's no message or anything, I just can't type or make any changes.

我将在 Visual Studio 2010 中调试站点并编辑一个*.aspx*.ascx文件,在没有警告的情况下,它会锁定,因此我无法对其进行编辑。没有消息或任何东西,我只是无法输入或进行任何更改。

The only way to start editing again is to stop debugging, close the editing window, and then find whatever file I was working on and reopen it. It's a huge pain in the you-know-what.

再次开始编辑的唯一方法是停止调试,关闭编辑窗口,然后找到我正在处理的任何文件并重新打开它。这是你知道的巨大痛苦。

My colleagues are experiencing the same thing, so it's apparently not something with my particular setup.

我的同事正在经历同样的事情,所以这显然与我的特定设置无关。

What's the explanation, and how can we make it stop?

有什么解释,我们怎样才能让它停止?



Note 1:I've reported this to Microsoft here. If you've experienced this as well, please go there and vote up the bug report.

注 1:我已在此处向 Microsoft 报告了此问题。如果您也遇到过这种情况,请去那里为错误报告投票。

Note 2:This is not VSS-related, at least in my case. We use VisualSVN, which doesn't use file-system-level locking to mark files as checked out.

注 2:这与 VSS 无关,至少在我的情况下是这样。我们使用 VisualSVN,它不使用文件系统级锁定来将文件标记为已签出。

采纳答案by Joost Schepel

Finally Microsoft came with a solution this year, you can download the fix here:

微软终于在今年推出了一个解决方案,你可以在这里下载修复:

http://connect.microsoft.com/VisualStudio/Downloads/DownloadDetails.aspx?DownloadID=40811

http://connect.microsoft.com/VisualStudio/Downloads/DownloadDetails.aspx?DownloadID=40811

回答by OlafW

I've found a temporary workaround-solution: Right-click on the file and select "Open with...". Now select "Source Code (Text) Editor" and you can edit the file again but without IntelliSense :-( But you won't need an external editor.

我找到了一个临时的解决方法:右键单击文件并选择“打开方式...”。现在选择“源代码(文本)编辑器”,您可以再次编辑该文件,但没有 IntelliSense :-( 但您不需要外部编辑器。

Nevertheless we still have to wait for Microsoft to find a better solution.

尽管如此,我们仍然需要等待微软找到更好的解决方案。

回答by BradB

As a workaround I use "Browse With..." (Right click in Solution Explorer) to load and view the page(s) when I'm making HTML refinements. You can't debug code of course but it doesn't lock the files so it makes the problem a little less irritating when making design changes.

作为一种解决方法,我在进行 HTML 优化时使用“浏览方式...”(在解决方案资源管理器中右键单击)来加载和查看页面。您当然不能调试代码,但它不会锁定文件,因此在进行设计更改时可以减少问题的刺激性。

I have replicated this issue with Windows 7, XP, both with and without source safe, MVC projects, web application projects and website project also with and without 'edit and continue' enabled i.e. I can edit the code but NOT the ASPX markup when using edit and continue!

我已经在 Windows 7、XP 中复制了这个问题,无论有没有源安全、MVC 项目、Web 应用程序项目和网站项目,也有启用和不启用“编辑并继续”的情况,即我可以编辑代码但不能在使用时编辑 ASPX 标记编辑并继续!

回答by Joris

I experienced the same issue, and found out that for me it occurred only in .aspxpages with an "eval"statement (used for databinding within e.g. a gridview) within <a>tags. As soon as I removed the "eval"statements, the pages became editable again while debugging.

我遇到了同样的问题,并发现对我来说它只发生在标签中.aspx带有"eval"语句(用于例如 gridview 中的数据绑定)的页面中<a>。一旦我删除了这些"eval"语句,调试时页面就会再次变得可编辑。

Example of code causing the page to be readonly while debugging:

调试时导致页面只读的代码示例:

<a href='<%# Eval("URL") %>' target="_blank" 
title='<%# Eval("URL", "Open url: {0}") %>'><b>'<%# Eval("Text") %>'</b></a>

Example of replacement code causing the page to be editable again while debugging:

导致页面在调试时再次可编辑的替换代码示例:

<asp:HyperLink NavigateUrl='<%# Bind("URL") %>' runat="server" ID="hlURL" Target="_blank"
ToolTip='<%# Bind("URL", "Open url: {0}") %>' Text='<%# Bind("Text") %>' Font-Bold="true" />

回答by Eugene

I was just having the same problem. When the code page disappers, I click debug->restart. It restarts the debugging process, and show all the pages I had open.

我只是遇到了同样的问题。当代码页消失时,我单击 debug->restart。它重新启动调试过程,并显示我打开的所有页面。

回答by Patrick

Try refreshing project containing that file, from the solution explorer. That should re-enable editing.

尝试从解决方案资源管理器刷新包含该文件的项目。那应该重新启用编辑。

回答by Bob Strom

Had the same problem with VS2010. R-click on the ASPX file and select the XML EDITOR -- then editing is enabled.

VS2010 也有同样的问题。右键单击 ASPX 文件并选择 XML EDITOR -- 然后启用编辑。

回答by Cheung

I can tell you it is known bug. It always happen when you edit on CSS or Javascript in Code View.

我可以告诉你这是已知的错误。当您在代码视图中编辑 CSS 或 Javascript 时,总是会发生这种情况。

I have report to MSDN forum and Microsoft Connect, but it seems it is rare bug,so not many people to solve that.

我已向 MSDN 论坛和 Microsoft Connect 报告,但似乎这是一个罕见的错误,因此解决该问题的人并不多。

回答by Matt Cofer

I have this problem and also have Resharper installed. Do those of you with the problem also have Resharper installed? I seem to have memory leaks in VS also that eventually bring VS to a crawl. Closing VS and re-opening it will fix the issue for a while. I have always assumed this was related to Resharper. Thoughts?

我有这个问题并且还安装了 Resharper。你们这些有问题的人是否也安装了 Resharper?我似乎在 VS 中也有内存泄漏,最终使 VS 陷入困境。关闭 VS 并重新打开它会暂时解决问题。我一直认为这与 Resharper 有关。想法?

回答by riwalk

Usually this is because of your version control system making the files readonly (namely VSS). Go into the settings for source control and set the editor so that it will checkout files when edited.

通常这是因为您的版本控制系统将文件设为只读(即 VSS)。进入源代码控制的设置并设置编辑器,以便在编辑时检出文件。

If it is not your source control, then it is that the files are being made readonly by something, and that 'something' is what you need to find to fix this problem.

如果它不是您的源代码管理,那么文件是由某些东西只读的,而您需要找到“某些东西”来解决此问题。