Visual Studio 2010 - XAML 编辑器非常慢
还有其他人在 VS 2010 的 XAML 编辑器中遇到过性能极其缓慢的情况吗?如果我有一个文件数量有限的新项目,那么性能就很好。但是,如果我的项目包含大量 XAML 文件,则 XAML 编辑器每隔几秒就会间歇性挂起,使其几乎无法使用。
我还应该注意到,性能仅在我引用 DevExpress 2010 的一个特定项目中缓慢。我不确定这是否相关。
任何有关解决此问题的建议将不胜感激。
克里斯
Has anyone else experience incredibly slow performance in the XAML editor in VS 2010? If I have a new project with a limited number of files, the performance is fine. However, if I have a project with a larger number of XAML files, the XAML editor hangs intermittently every few seconds, making it almost impossible to use.
I should also note that the performance is only slow in one particular project where I am referencing DevExpress 2010. I am not certain if this is related.
Any suggestions on solutions to this problem would be greatly appreciated.
Chris
如果你对这篇内容有疑问,欢迎到本站社区发帖提问 参与讨论,获取更多帮助,或者扫码二维码加入 Web 技术交流群。
绑定邮箱获取回复消息
由于您还没有绑定你的真实邮箱,如果其他用户或者作者回复了您的评论,将不能在第一时间通知您!
发布评论
评论(5)
在 Visual Studio 2012 中:
转到
选中
始终在 XAML 视图中打开文档
并取消选中自动填充工具箱项目
。在 Visual Studio 2015、2017 中:
取消选中
自动填充工具箱项
。这解决了我同样的问题。
In Visual Studio 2012:
Go to
Check
Always open documents in XAML view
and uncheckAutomatically populate toolbox items
.In Visual Studio 2015, 2017:
Go to
uncheck
Automatically populate toolbox items
.This fixed my same problem.
如果您不需要视觉设计器,您可以在 Visual Studio 中选择不同的编辑器:
右键单击 xaml 文件 ->打开方式... ->源代码(文本)编辑器
您只会丢失分割视图,智能感知等仍然可以工作。
如果您需要在设计器中检查某些内容,您仍然可以单击“视图设计器”以再次打开普通的 XAML 编辑器。
如果您想提高可视化设计器的性能,请尝试在代码隐藏中检查
DesignerProperties.GetIsInDesignMode
。可视化工具实例化您的控件以了解如何显示它们,从而执行部分隐藏代码。If you don't need the visual designer, you can select a different editor in visual studio:
Right click the xaml file -> Open With... -> Source Code (Text) Editor
You will only lose the split view, intellisense etc. should still work.
If you need to check something in the designer you can still click 'view designer' to open the normal XAML editor again.
If you want to improve the performance of the visual designer, try checking
DesignerProperties.GetIsInDesignMode
in your code-behind. The visualiser instantiates your controls to know how to display them, thus executing parts of the code-behind.与 OP 一样,我在一个严重依赖 DevExpress WPF 控件的项目中的 xaml 编辑器中出现了极大的滞后。在尝试使用此处发布的其他解决方案未能成功解决此问题后,我最终尝试删除我的解决方案用户选项 (.suo) 文件,该文件通常与解决方案 (.sln) 位于同一文件夹中文件。这立即解决了问题。您可能想阅读此发布关于 Visual Studio 在 suo 文件中存储的内容,以便您可以重置任何重要的内容(例如构建配置 - 例如,我的总是将活动解决方案平台默认回“混合平台”)
Like the OP, I had extreme lag in the xaml editor on a project that relied heavily on DevExpress WPF controls. After trying unsuccessfully to resolve this issue with the other solutions posted here, I eventually tried deleting my Solution User Options (.suo) file, which is usually located in the same folder as the solution (.sln) file. This immediately resolved the issue. You may want to read this post about what visual studio stores in the suo file so you can reset anything important (such as build configuration - mine always defaults the active solution platform back to "Mixed Platforms" for example)
简短回答:如果您不经常使用设计器,只需替换 XAML 的默认编辑器即可,从而摆脱 XAML 可视化设计器并加快速度。右键单击任何 XAML 文件,单击打开方式...,然后选择另一个默认编辑器。源代码(文本)编辑器工作得很好。
现在应该已经好了。如果您想了解细节并完全摆脱缓慢的设计师,请阅读长答案。
长答案:这里很好地解释了发生的情况以及为什么这么慢。
基于上述文章的简短待办事项,以便完全禁用 XAML 的可视化设计器:
Short answer: if you do not use designer much, just replace the default editor for XAML, thus getting rid of XAML visual designer and speeding things up. Right click any XAML file, click Open with... and choose another default editor. Source code (text) editor works just fine.
Now it should be already fine. If you want to understand the details and completely get rid of the slow designer, read the long answer.
Long answer: Here is a nice explanation of what happens and why is it that slow.
A brief todo based on the aforementioned article in order to completely disable the visual designer of XAML:
在使用 dev Express 时,我注意到 Visual Studio 设计器中的响应有些滞后。这似乎是由于 DevExpress 产品的许可证认证所致。
如果删除“Licenses.Licx”文件(位于项目属性文件夹中),您会注意到性能显着提高。
注意:删除许可证文件不会阻止您使用 DevExpress 控件。但它确实阻止了 VS 不断验证它。
While using dev express, I've noticed some laggy response in the Visual Studio designer. This appears to be due to the license authentication of the DevExpress products.
If you delete the "Licenses.Licx" file (found in the project properties folder) you'll notice a marked improvement in performance.
Note: Removing the license file doesn't stop you from using DevExpress controls. But it does stop VS from constantly authenticating it.