【问题标题】:Visual Studio 2013 context menus slow only in web application projectVisual Studio 2013 上下文菜单仅在 Web 应用程序项目中变慢
【发布时间】:2014-07-09 14:48:23
【问题描述】:

我最近为一个新项目从 VS 2010 升级到 VS 2013。我发现在我的 Web 应用程序项目中右键单击文件夹(而不是单个文件)时,加载上下文菜单大约需要 2 秒。解决方案中的其他十几个非 Web 项目没有这个性能问题。此外,在那个缓慢的上下文菜单中,如果我单击“添加”-> 项目以调出子菜单以添加新的视图/类/任何内容,则该菜单需要 5-10 秒才能出现。如果我认为从那里选择“新脚手架项目”之类的内容,则该对话框可能需要大约 30 秒才能出现。

我项目中的其他人似乎没有遇到这个问题,尽管他们的硬件稍好一些,并且运行的是 Windows 8(而我运行的是 Windows 7)。我试过禁用here 描述的视觉体验元素,但它似乎没有效果。我的系统似乎只使用了 8GB 可用 RAM 中的大约 5GB,而我的 CPU 使用率从未超过 30%。我已尝试禁用 ReSharper,以防万一导致速度变慢,但它对性能没有影响。

如何解决这个巨大的减速问题?

Microsoft Visual Studio Premium 2013
Version 12.0.30501.00 Update 2
Microsoft .NET Framework
Version 4.5.50938

Installed Version: Premium

LightSwitch for Visual Studio 2013   06191-004-0454001-02932
Microsoft LightSwitch for Visual Studio 2013

Office Developer Tools - May 2014 Update ENU   06191-004-0454001-02932
Microsoft Office Developer Tools for Visual Studio 2013 - May 2014 Update ENU

Team Explorer for Visual Studio 2013   06191-004-0454001-02932
Microsoft Team Explorer for Visual Studio 2013

Visual Basic 2013   06191-004-0454001-02932
Microsoft Visual Basic 2013

Visual C# 2013   06191-004-0454001-02932
Microsoft Visual C# 2013

Visual C++ 2013   06191-004-0454001-02932
Microsoft Visual C++ 2013

Visual F# 2013   06191-004-0454001-02932
Microsoft Visual F# 2013

Visual Studio 2013 Code Analysis Spell Checker   06191-004-0454001-02932
Microsoft® Visual Studio® 2013 Code Analysis Spell Checker

Portions of International CorrectSpell™ spelling correction system © 1993 by Lernout & Hauspie Speech Products N.V. All rights reserved.

The American Heritage® Dictionary of the English Language, Third Edition Copyright © 1992 Houghton Mifflin Company. Electronic version licensed from Lernout & Hauspie Speech Products N.V. All rights reserved.

ASP.NET and Web Tools   2013.2.50425
Microsoft Web Developer Tools contains the following components:
Support for creating and opening ASP.NET web projects
Browser Link: A communication channel between Visual Studio and browsers
Editor extensions for HTML, CSS, and JavaScript
Page Inspector: Inspection tool for ASP.NET web projects
Scaffolding: A framework for building and running code generators
Server Explorer extensions for Windows Azure Web Sites
Web publishing: Extensions for publishing ASP.NET web projects to hosting providers, on-premises servers, or Windows Azure

ASP.NET Web Frameworks and Tools 2012.2   4.1.21001.0
For additional information, visit http://go.microsoft.com/fwlink/?LinkID=309563

ASP.NET Web Frameworks and Tools 2013   5.1.20409.0
For additional information, visit http://www.asp.net/

Common Azure Tools   1.1
Provides common services for use by Azure Mobile Services and Windows Azure Tools.

JetBrains ReSharper 8.2.1   C# Edition build 8.2.1000.4556 on 2014-05-19T16:12:38
JetBrains ReSharper 8.2.1 package for Microsoft Visual Studio. For more information about ReSharper, visit http://www.jetbrains.com/resharper/. Copyright © 2003–2014 JetBrains, Inc.

NuGet Package Manager   2.8.50313.46
NuGet Package Manager in Visual Studio. For more information about NuGet, visit http://docs.nuget.org/.

PreEmptive Analytics Visualizer   1.2
Microsoft Visual Studio extension to visualize aggregated summaries from the PreEmptive Analytics product.

SQL Server Data Tools   12.0.30919.1
Microsoft SQL Server Data Tools

TechTalk SpecFlow   1.9.3
TechTalk SpecFlow - Binding business requirements to .NET code, http://www.specflow.org
Copyright © 2009–2013 TechTalk

Windows Azure Mobile Services Tools   1.1
Windows Azure Mobile Services Tools

Windows Azure Tools   2.3
Windows Azure Tools for Microsoft Visual Studio 2013 - v2.3.20320.1602

Windows Phone 8.1 SDK Integration   1.0
This package integrates the tools for the Windows Phone 8.1 SDK into the menus and controls of Visual Studio.

Workflow Manager Tools 1.0   1.0
This package contains the necessary Visual Studio integration components for Workflow Manager.

更新:为了解决这个问题,我彻底擦除了我的硬盘并更新到 Windows 8。我还升级到了 16GB 的 RAM。然后我安装了足够的软件,以便我可以编译项目。我仍然遇到同样的减速。但是,如果我创建一个全新的 Web 应用程序,上下文菜单会很快。项目本身的某些事情会导致放缓吗?

【问题讨论】:

  • 我也遇到了同样的问题...延迟 30 秒才能在 Web 项目上显示上下文菜单!你有没有弄清楚是什么原因造成的?
  • 不幸的是,没有。而且那个项目现在已经结束了,所以如果真的有答案,我可能无法测试答案。我想知道 VS 2015 是否会遇到同样的问题。
  • @AlexEdelstein 安装 Windows SDK/Windows Performace Toolkit (msdn.microsoft.com/en-US/windows/desktop/bg162891),运行 WPRUI.exe,选择 CPU、磁盘、FileIO、VirtualAlloc、ResidentSet、XAML 并按开始。现在执行慢速 VS 操作,返回 WPRUI 并在 Save 上计时并将其存储到 ETL 文件中。将 ETl 文件 + NGENPDB 文件夹压缩为 zip,上传 zip 并在此处发布链接。
  • 感谢您的建议。我们目前无法重现我们一直看到的 30 秒延迟。运行 WPRUI 似乎涉及相当多的手术,包括禁用寻呼执行器,这是我们不满意的东西,所以我们暂时搁置这个建议。
  • 文件夹中是否有大量文件可能不包含在项目中?不久前我经历过类似的事情,我怀疑这是因为 Visual Studio 或其中一个扩展正在扫描项目文件夹,但它在我的节点模块和凉亭组件中有大量文件。这可能是试图扫描文件夹,或者可能是源代码控制执行类似的操作(git、TFS),即使设置为忽略这些包。现在,您可以选择试用 Visual Studio 2015!试试看是否还有问题。

标签: visual-studio-2013


【解决方案1】:

我和你有同样的问题。旧的 Web 项目正在生效,新的 Web 项目还可以。

我发现我在项目中使用了很多 NuGet 包,并且本地 NuGet 缓存 (C:\Users\xxx\AppData\Local\NuGet\Cache) 是空的,因为这是新机器。

我重新编译了整个解决方案。 NuGet 包缓存在该文件夹中。编译成功后,问题解决。

我不确定发生了什么,但这解决了我的问题。奇怪的是我需要重新编译所有解决方案。未编译的解决方案有这个问题,编译后就没有了。

【讨论】:

  • 我现在已经重新编译了数百次解决方案,但还是没有成功。我检查了你提到的缓存,在那里只看到了大约 20% 的 NuGet 包,所以我手动添加了其余的包并重新启动了 Visual Studio,然后重新构建。但它并没有加快任何速度。
【解决方案2】:

长期以来,我们一直在为同一个问题苦苦挣扎。右键单击一个项目或项目内的任何文件夹,这通常需要至少 10 秒才能显示菜单。解决方法很简单。

只需删除所有损坏的引用。

请参考下图。需要删除此类损坏的引用。

删除这些引用并再次尝试右键单击,上下文菜单将在几分之一秒内出现。

这对我们有用。

【讨论】:

  • 这应该是一个可以接受的答案,损坏的参考文献在 2013 年以上有这种回归行为。看到这个问题——stackoverflow.com/questions/33937856/…
  • @scaryman 同意了。这绝对解决了 VS2015 上的问题。
【解决方案3】:

如果它发生在单个项目意味着,您可以尝试以下方式

  1. 删除项目中的 .suo 文件。
  2. 然后重新启动视觉工作室。
  3. 再次尝试加载您的项目。

这可能会为您提供一个很好的解决方案。

【讨论】:

  • 这不仅仅发生在一个项目中,但谢谢。
【解决方案4】:

只是为了增加可能的解决方案,我遇到了同样的问题。

顺便说一句,我正在使用带有 R# 和 NCrunch 的 VC-2013 Ultimate。

右键单击任何解决方案项目都需要很长时间。我关闭了解决方案并删除了解决方案目录中的 _ResharperXXX 文件夹。

我重新启动解决方案后问题就消失了。

这已经发生了好几次了,我每次都通过上面的方法来解决它。

【讨论】:

    猜你喜欢
    • 2015-06-16
    • 1970-01-01
    • 1970-01-01
    • 1970-01-01
    • 1970-01-01
    • 1970-01-01
    • 1970-01-01
    • 2015-11-12
    • 2014-06-14
    相关资源
    最近更新 更多