Tweaking the environment to speed up Visual Studio

Burak Tasci
Mar 9, 2017 · 5 min read

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.

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.

// 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
// 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.

  • Uncheck “Automatically adjust visual experience based on client performance
  • Uncheck “Enable rich client visual experience
  • Check “Use hardware graphics acceleration if available
  • Uncheck “Save AutoRecover information every
  • Check “Save documents as Unicode when data cannot be saved in codepage
  • 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)
  • Set “At startup” to “Show empty environment at startup
  • Uncheck “Download content every
  • Uncheck “Synchronize settings across devices when signed into Visual Studio
  • Uncheck “Track active item in solution explorer
  • Check “Lightweight solution load for all solutions
  • Check “Only build startup projects and dependencies on run
  • 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)
  • Uncheck “Track changes
  • Uncheck “Enable virtual space
  • check “Line numbers
  • Uncheck “Navigation bar
  • Uncheck “Show annotations over vertical scroll bar
  • Uncheck “Enable CodeLens
  • Uncheck “Enable full solution analysis
  • Uncheck “Enable full solution analysis
  • Uncheck “Show completion list after a character is deleted”
  • Set “Snippets behavior” to “Never include snippets
  • Set “Enable CoffeeLint” to false
  • Set “Enable CSS Lint” to false
  • Set “Show errors as warningsfalse
  • Set “Enable ESLint” to false
  • Uncheck “Enable Intellisense
  • Uncheck everything (if ReSharper is used for formatting assistance)
  • Uncheck “Suppress JIT optimization on module load (Managed only)
  • Uncheck “Enable Edit and Continue
  • Uncheck “Script
  • Uncheck “Enable IntelliTrace
  • Set “Check for surveys/news” to “Never
  • Uncheck “Enable Web Forms Designer
  • Set “Automatically Populate Toolbox” to false
  • 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

In depth articles about software technologies

Medium is an open platform where 170 million readers come to find insightful and dynamic thinking. Here, expert and undiscovered voices alike dive into the heart of any topic and bring new ideas to the surface. Learn more

Follow the writers, publications, and topics that matter to you, and you’ll see them on your homepage and in your inbox. Explore

If you have a story to tell, knowledge to share, or a perspective to offer — welcome home. It’s easy and free to post your thinking on any topic. Write on Medium

Get the Medium app

A button that says 'Download on the App Store', and if clicked it will lead you to the iOS App store
A button that says 'Get it on, Google Play', and if clicked it will lead you to the Google Play store