VisualStudio2017在生成和调试期间速度太慢

我刚刚在一台电脑上安装了 Visual Studio 2017,它具有以下规格:

英特尔至强 E5-1600 v3@3.50 GHz 处理器, 16GB 内存和 Windows 10 Pro 64位操作系统 .

虽然 PC 的性能几乎是完美的,但是我经常在 Visual Studio 2017中遇到速度慢的问题,特别是在构建和调试过程中。除此之外,有时我需要在 “没反应”消息之后重新启动它。

对于 Visual Studio 2017的这个问题是否有一个稳定的解决方案? 。

95150 次浏览

In order to obtain a better performance in Visual Studio 2017, some kind of Performance Tweaks can be applied as shown below:

  1. Set Current source control … to None under ToolsOptionsSource Control

  2. Uncheck Synchronized settings across ... option under ToolsOptionsEnvironmentSynchronized Settings (for some versions: ToolsOptionsEnvironmentAccounts)

  3. Disable CodeLens (Optional): Uncheck Enable CodeLens option under ToolsOptionsText EditorAll Languages

  4. Disable Diagnostic Tools (Optional): Uncheck Enable Diagnostic Tools while debugging option under ToolsOptionsDebuggingGeneral

  5. Clean the contents in the following folders (do not delete these folders, instead delete their contents only) and restart Visual Studio:

    Clean the content in WebSiteCache folder (can be found in
    C:\Users\%USERNAME%\AppData\Local\Microsoft\WebSiteCache)

    Clean the content in Temporary ASP.NET Files folder (can be found in
    C:\Users\%USERNAME%\AppData\Local\Temp\Temporary ASP.NET Files)

Note: If you have Hardware Acceleration enabled or if you use the default Visual experience settings in Microsoft Visual Studio 2017 or Visual Studio 2015, you might experience intermittent performance issues, product crashes, or rendering issues. In order to work around these issues, apply the following settings under ToolsOptionsEnvironmentGeneral

enter image description here

For more information, visit You experience performance issues, product crashes, or rendering issues in Visual Studio 2015 and Visual Studio 2013.

If the problem is related to debugging, try the workaround on Visual Studio debugging/loading very slow.

I hope this helps...

My problem was with Lightweight Solution Load. Once I disabled that everything went back to normal.

I have tried all the above solutions, and followed many of the relevant links. None of them worked.

After pulling off all my hair, and filling up another cup of coffee, I decided to update Visual Studio 2017. Boom, everything is back to normal now (except for my hair and a caffeinated brain).

So, if you ever encounter the same issue, I suggest you to check your Visual Studio 2017 update first. If there is any available update, update!

Download procmon and run to check the background activities done by msbuild or visual studio. Visual studio can be extremely slow or almost unusable in case its writing log using fuslogvw.

Steps to stop fuslogvw log writer.

1) Window+R, type RegEdit 2) GoTO path HKEY_LOCAL_MACHINE\SOFTWARE\Microsoft\Fusion 3) Set hexadecimal value of Force Log to 0.

Visual Studio will start performing normal.

I got this link to Manage Visual Studio Performance in my VS 2017

Note: You can also open this window from: Help -> Manage Visual Studio Performance

According to the screenshot below, Developer Analytics Tools adds 5 sec (on avg) to Solution Load time. I have disabled it.

enter image description here

I am running VS 2017 on a system that has 128GB of RAM and 4 Quad Core Xeon Processors with SSD. I am of course using Windows 10 Pro for Workstations in order to support my quad CPU build.

What really helped me to decrease my build time to less than 2 seconds was this simple trick:

Setting the Host computer's setting to optimise on "Background Services" using Windows' properties, Advanced System Settings, Advanced, Advanced tab.

Also, considering that I have huge amount of RAM and I have never seen even a quarter of it being used was to disable Page file. (Windows will warn about the consequences)

Also, it is worth adding VS installation and project folder to a list of exceptions in the anti-virus settings (In my case, Windows Defender)

I had a similar problem with the VS Community version 2017 and I disabled the "Enable Diagnostic Tools while debugging", only it, nothing more...!!!

Tools> Options> Debuggin> General> Enable Diagnostic Tools while debugging

There can be solution with priority..

  1. Disable Diagnostic Tools

enter image description here

  1. Disable rich client visual experience

enter image description here

  1. Disable all sync setting.

enter image description here

Also, make sure you remove the cache by using run -> %temp%. good luck.

I observed that “perfwatson2.exe” process use highest utilization of CPU/Memory/Disk while build VS 2017. perfwatson2 process collects data of system action which takes more time (around 2+ seconds) and send those data to Microsoft. Microsoft team can analyses the data and find solution for same.

Below steps will help you to stop perfwatson2 service/process.

Open VS2017 and go to Help => Send Feedback => Settings and set No, I would not like to participate option

In a newer version of Visual Studio, this option has been moved to Help => Privacy => Privacy Settings

enter image description here

Try deleting the .vs folder that VS2017 creates in the local code repository. Then open the solution again.

After trying all of the above suggestions I was still having issues. My fix was to clear NuGet Cache.

Tools-Options-Nuget Package Manager-General

Wild ..I still had a build issue (VS 2017 seeming to hang on "importing project references..") after following some steps in the accepted answer.

Out of ideas, I ran "Clean Solution", then I closed Visual Studio, then relaunched the project from the .sln file ...and suddenly it was building fine.

Unreal. Hopefully this helps someone.