在 Visual Studio 中刷新自动完成 (IntelliSense) 数据库
我注意到 Visual Studio 中的自动完成功能在项目已经达到一定的规模(在我的例子中大约有 4,100 行代码).我还注意到,一旦第三方库的数量增加(命名空间和类属性和方法不再可见),性能也会下降.
I've noticed that the auto complete feature in Visual Studio no longer works properly once my project has reached a certain size (in my case ~4,100 lines of code). I've also noticed that performance also degrades once the number of third-party libraries increases (namespaces and class attributes and methods are no longer visible).
有没有办法手动更新自动完成数据库或为现有项目创建一个新数据库?
Is there a way of manually updating the auto completion database or create a new one for an existing project?
我目前在 Visual Studio 2008 下工作,但我经历过这种情况Visual Studio 2010 中的问题.
I am currently working under Visual Studio 2008, but I have experienced this issue in Visual Studio 2010 as well.
推荐答案
对于 VS2015、2017 和 VS2019,请关闭 Visual Studio 并删除解决方案所在文件夹中的 .vs 文件夹.其中包含智能感知数据库(如果我们知道哪些文件,应该可以只删除特定于智能感知的文件).请注意,如果您删除整个文件夹,您将丢失窗口布局配置等.
For VS2015, 2017 and VS2019 close Visual Studio and delete the .vs folder in the same folder as the solution. It contains among other things the intellisense database (it should be possible to delete only the files specific to intellisense, if we knew which ones). Note that if you delete the whole folder you will lose your window layout configurations etc.
对于以前的版本,关闭 Visual Studio 并导航到您的项目文件夹.那里的 *.sdf 文件包含智能感知数据库 - 如果您删除此文件并在 Visual Studio 中重新打开您的项目,它会重建缓存.
For previous versions, close Visual Studio and navigate to your project folder. The *.sdf file there contains the intellisense database- if you delete this files and reopen your project in visual studio, it rebuilds the cache.
删除 sdf 文件为我解决了问题.
Deleting the sdf file solved the problem for me.
有时使用大型解决方案(主要是 C++ 项目)会变成慢得无法忍受.要修复它,您需要关闭解决方案并继续删除 .SDF 文件.之后它又恢复正常了,大约一周左右,直到您需要再做一次.
Sometimes working with a big solution (mainly C++ projects) becomes unbearably slow. To fix it you need to close the solution and go delete the .SDF file. After that it returns to normal again, for about a week, or so until you need to do it again.
根本原因是 SDF 文件变得碎片化,并且,根据我所做的 xperf 分析,VS 有时会做 20,000+在调试和发布之间更改时随机读取它.推杆SSD 上的 SDF 文件可以解决问题,但不是必需的.VS需要更高效地使用SDF文件而不是阻塞SDF操作,永远.
The underlying cause is that the SDF file gets fragmented and, according to xperf profiling I've done, VS will sometimes do 20,000+ random reads from it when changing between debug and release. Putting the SDF files on an SSD fixes the problem but should not be necessary. VS needs to use the SDF file more efficiently and not do blocking SDF operations, ever.
来源:https://visualstudio.uservoice.com/forums/121579-visual-studio/suggestions/2255455-fix-the-delete-sdf-file-problem
相关文章