Tweaking the environment to speed up Visual Studio

Burak Tasci
Burak Tasci
Published in
5 min readMar 9, 2017

--

Every developer’s dream is to work on an environment capable of responding the commands, compiling and debugging in alignment with the developer’s speed of thought.

Although such computers and development tools do not exist on the market yet, there’re a few tricks that could boost Visual Studio performance and responsiveness, reduce the time spent for builds, and increase overall productivity and efficiency.

SSD Upgrade

First of all, upgrade to SSD drives if you’re still using those old-fashioned spinning-disk drives. It will help improving overall productivity more than any other upgrade to your hardware — as spinning HDDs are the main bottleneck for overall system performance.

Configuring Windows Defender

The second step is to tweak the Windows Defender (aka Antimalware Service Executable at the Task Manager), which causes the builds take excruciatingly long time to complete.

To test the issue on your computer, simply launch a Task Manager and watch it while Visual Studio rebuilds the solution.

Notice that Windows Defender is consuming more or less the same amount of CPU time as Visual Studio, causing your builds taking more time than it absolutely has to.

Turning off Real-time protection from the Windows Defender settings could give you an overview about potential performance gains. However, turning it off would not be a permanent solution, because the Antimalware Service turns itself on automatically after a while — to ensure the system is protected.

Exclude Visual Studio and other tools from Windows Defender

The only way to solve this issue is to configure Windows Defender by excluding the Visual Studio (devenv.exe), MSBuild, and other processes (dotnet.exe, node.exe, etc), project & cache folders (npm/nuget/resharper, etc.).

There’s a list of exclusions below for a system with Visual Studio 2017 Professional, ReSharper and Node.js installed.

Excluded processes

// visual studio & tools
C:\Program Files (x86)\Microsoft Visual Studio\2017\Professional\Common7\IDE\devenv.exe
C:\Windows\Microsoft.NET\Framework\v4.0.30319\MSBuild.exe
C:\Windows\Microsoft.NET\Framework64\v4.0.30319\MSBuild.exe
C:\Program Files (x86)\MSBuild\14.0\Bin\MSBuild.exe
C:\Program Files\dotnet\dotnet.exe
// Node.js
C:\Program Files (x86)\Microsoft Visual Studio\2017\Professional\Web\External\node.exe
C:\Program Files (x86)\Microsoft Visual Studio\2017\Professional\Common7\ServiceHub\Hosts\ServiceHub.Host.Node.x86\ServiceHub.Host.Node.x86.exe
// Node.js (if installed separately or upgraded)
C:\Program Files\nodejs\node.exe

Excluded folders

// project folder (whole drive is assigned for projects)
D:\
// visual studio & tools
C:\Program Files (x86)\Microsoft Visual Studio 10.0
C:\Program Files (x86)\Microsoft Visual Studio 14.0
C:\Program Files (x86)\Microsoft Visual Studio
C:\Windows\assembly
C:\Windows\Microsoft.NET
C:\Program Files (x86)\MSBuild
C:\Program Files\dotnet
C:\Program Files (x86)\Microsoft SDKs
C:\Program Files\Microsoft SDKs
C:\Program Files (x86)\Common Files\Microsoft Shared\MSEnv
C:\Program Files (x86)\Microsoft Office
// cache folders
C:\ProgramData\Microsoft\VisualStudio\Packages
C:\Program Files (x86)\Microsoft SDKs\NuGetPackages
C:\Windows\Microsoft.NET\Framework\v4.0.30319\Temporary ASP.NET Files
C:\Windows\Microsoft.NET\Framework64\v4.0.30319\Temporary ASP.NET Files
C:\Users\{{USERNAME}}\AppData\Local\Microsoft\VisualStudio
C:\Users\{{USERNAME}}\AppData\Local\Microsoft\WebsiteCache
C:\Users\{{USERNAME}}\AppData\Local\Jetbrains
C:\Users\{{USERNAME}}\AppData\Roaming\Microsoft\VisualStudio
C:\Users\{{USERNAME}}\AppData\Roaming\JetBrains
C:\Users\{{USERNAME}}\AppData\Roaming\npm
C:\Users\{{USERNAME}}\AppData\Roaming\npm-cache

Turning off Indexing

It’s a common practice for developers to keep a flat folder structure and store related files near each other in an intuitive location, so they tend to know where all the files are and rarely perform a file search.

Indexing Service is another essential bottleneck for the development environment, pulling the disk I/O to 100% during builds and installing packages (i.e. NuGet, npm, bower )— as well as shortening the lifetime of SSD drives.

The solution is easy, and direct: getting rid of Indexing Service completely.

Please note that, it’s STILL possible to search for files on the computer, even though the Indexing Service is turned off: it will just search without index.

Simply, open the command prompt, type services.msc, and press enter. At the list of services, scroll down until you find Windows Search service. You’ll notice it has probably a Started status and Automatic startup type.

Go to the properties of Windows Search service, stop the service and set the startup type to Disabled. And finally, make a system restart.

Visual Studio settings

The last step is to configure the Visual Studio (in this article, the settings apply to Visual Studio 2017 Professional) and disable resource-killing features on the environment. Below is a list of recommended settings to improve UI responsiveness and environment performance, based on best practices.

Environment -> General

  • Uncheck “Automatically adjust visual experience based on client performance
  • Uncheck “Enable rich client visual experience
  • Check “Use hardware graphics acceleration if available

Environment -> AutoRecover

  • Uncheck “Save AutoRecover information every

Environment -> Documents

  • Check “Save documents as Unicode when data cannot be saved in codepage

Environment -> Keyboard

  • Set “ForceGC” to ctrl+num1
  • Set “ReSharper_Toggle” to ctrl+num0 (if ReSharper is used)
  • Set “ReSharper_EnableDaemon” to ctrl+num8 (if ReSharper is used)

Environment -> Startup

  • Set “At startup” to “Show empty environment at startup
  • Uncheck “Download content every

Environment -> Synchronized settings

  • Uncheck “Synchronize settings across devices when signed into Visual Studio

Projects and Solutions

  • Uncheck “Track active item in solution explorer
  • Check “Lightweight solution load for all solutions

Projects and Solutions -> Build and Run

  • Check “Only build startup projects and dependencies on run

Projects and Solutions -> Web Package Management

  • Set “Restore on Project Open” to false (for Bower)
  • Set “Restore on Save” to false (for Bower)
  • Set “Restore on Project Open” to false (for NPM)
  • Set “Restore on Save” to false (for NPM)

Text Editor -> General

  • Uncheck “Track changes

Text Editor -> All Languages -> General

  • Uncheck “Enable virtual space
  • check “Line numbers
  • Uncheck “Navigation bar

Text Editor -> All Languages -> Scroll Bars

  • Uncheck “Show annotations over vertical scroll bar

Text Editor -> All Languages -> CodeLens

  • Uncheck “Enable CodeLens

Text Editor -> Basic -> Advanced

  • Uncheck “Enable full solution analysis

Text Editor -> C# -> Advanced

  • Uncheck “Enable full solution analysis

Text Editor -> Basic, C# -> IntelliSense

  • Uncheck “Show completion list after a character is deleted”
  • Set “Snippets behavior” to “Never include snippets

Text Editor -> CoffeeScript -> CoffeeLint

  • Set “Enable CoffeeLint” to false

Text Editor -> CSS -> CssLint

  • Set “Enable CSS Lint” to false

Text Editor -> CSS, HTML, JSON, LESS, SCSS -> Advanced

  • Set “Show errors as warningsfalse

Text Editor -> JavaScript/TypeScript -> EsLint

  • Set “Enable ESLint” to false

Text Editor -> SQL Server Tools, U-SQL -> Intellisense

  • Uncheck “Enable Intellisense

Text Editor -> [Language] -> Formatting -> General

  • Uncheck everything (if ReSharper is used for formatting assistance)

Debugging

  • Uncheck “Suppress JIT optimization on module load (Managed only)
  • Uncheck “Enable Edit and Continue

Debugging -> Just-In-Time

  • Uncheck “Script

IntelliTrace

  • Uncheck “Enable IntelliTrace

Node.js Tools

  • Set “Check for surveys/news” to “Never

Web Forms Designer

  • Uncheck “Enable Web Forms Designer

Windows Forms Designer

  • Set “Automatically Populate Toolbox” to false

XAML Designer

  • Uncheck “Enable XAML Designer

Further methods

Tips and tricks explained above would definitely help to gain a significant performance boost. However, there’re a few more things to do, helping the development environment to make the builds as quickly as possible.

  • Disabling extensions such as Microsoft Office 365 API Tools, TypeScript for Microsoft Visual Studio (better stick to npm, gulp/webpack)
  • Using Visual Studio in safe mode
  • Using a RAM disk for the source files
  • Changing the “Copy local” property of reference assemblies to “false”, according to the dependency tree
  • Configuring ReSharper for optimized performance (could be a topic of another article)

Please feel free to add your thoughts in the comments, highly appreciated!

Burak Tasci (fulls1z3)
https://www.linkedin.com/in/buraktasci
http://stackoverflow.com/users/7047325/burak-tasci
https://github.com/fulls1z3

--

--

Burak Tasci
Burak Tasci

Full-stack software engineer and enthusiastic power-lifter