Visual Studio Intellisense stops working when creating new files – FIX How to fix Visual Studio Intellisense errors when creating a new file

Visual Studio 2017 - Lost Razor Intellisense and Syntax Highlight - How to Fix it

If you’ve stumbled upon this post it most likely means that you’re struggling with a strange issue with Visual Studio Intellisense: it seems to work fine for existing files, but it show non-existing “errors” (in the Error Window and through the “red wavy underlines” inside the file) when you either create a new source code file or copy/paste an existing one.

These errors are usually related to “missing” classes or namespaces, that do actually exist (and often even compile properly).

Luckily enough, there are a couple workaround that can hopefully fix this nasty issue.

Fix #1: Delete the /.vs/ folder

The first thing to try when this issue hits your project is to entirely remove the /.vs/ folder, which is the directory where Visual Studio stores some user-related configuration files and temporary data: deleting that folder is safe, since VS will automatically recreate it when it opens the solution (if it doesn’t exist).

Here are the required steps to do:

  • Close Visual Studio
  • Delete the /.vs/ folder (which can be found in the solution’s root folder).
  • Re-open Visual Studio

It’s worth noting that the /.vs/ root folder only exists since Visual Studio 2015: if you’re using Visual Studio 2013 or below, you can achieve the same results by directly deleting the .suo solution file, which is placed in the solution’s root folder as well.

Fix #2: Delete the /bin/ and /obj/ folders

If the above method doesn’t fix your issue, you can try to do the same with the /bin/ and the /obj/ folders:

  • Close Visual Studio
  • Delete the /bin/ and /obj/ folders (which can be found in the solution’s root folder).
  • Re-open Visual Studio

This workaround is often required when those folders contain some old DLL file (for example, when you change the Assembly Name of one or more projects): when this happens, the Build -> Clean command might be unable to automatically sort things out, since it will only clean up the known project files.

Sources

 

About Ryan

IT Project Manager, Web Interface Architect and Lead Developer for many high-traffic web sites & services hosted in Italy and Europe. Since 2010 it's also a lead designer for many App and games for Android, iOS and Windows Phone mobile devices for a number of italian companies. Microsoft MVP for Development Technologies since 2018.

View all posts by Ryan

Leave a Reply

Your email address will not be published. Required fields are marked *

This site uses Akismet to reduce spam. Learn how your comment data is processed.