Jimmy
Jimmy

Reputation: 5241

Visual Studio 2013 reporting erroneous "does not contain a definition for" error for recent extension methods

Visual Studio 2013 (vs) compiles a solution fine when manually building (i.e., it reports "Build succeeded", there are no errors in the error list, and running a program shows the latest changes). However, when vs starts building in the background (for Intellisense?), then errors start to come up for recently added extension methods. The extension methods are underlined in red, and right-clicking on them to "go to definition" results in an error that says "Cannot navigate to [method name]".

Extension methods that were created (in the same classes as the methods listed in the erroneous error messages) previous to when this started happening do not show up in the error messages.

I have done a build clean, to no avail.

I do not have resharper installed.

How do I reset the intelisense cache in Visual Studio 2013? I see instructions for Visual Studio 2008, but not for Visual Studio 2013.

Upvotes: 10

Views: 7203

Answers (6)

User42
User42

Reputation: 1

Very old question, but it happened to me also with VS2019. I have multiple projects in my solution: right-click on the project -> "Unload Project" for each one, and then reload them. This worked for me.

  • Clean + Build, or
  • Close all the files + restart VS + clean

Those didn't work (for me).

Upvotes: 0

perencia
perencia

Reputation: 1552

In VS2010, the only thing that worked for me was removing and adding the reference again.

Upvotes: 0

Aneeq Azam Khan
Aneeq Azam Khan

Reputation: 1032

After testing all above mentioned solutions simply clean and build worked for me.

Upvotes: 0

GregC
GregC

Reputation: 8007

I had a similar problem that I resolved by deleting *.sdf file in the solution directory. VS2013 will re-create it.

UPDATE This is what I know now: https://stackoverflow.com/a/38708050/90475

Upvotes: 3

apk
apk

Reputation: 1681

For Visual Studio 2015, my solution didn't have an .sdf file, and restarting didn't help. However, the following steps fixed my problem:

  1. Close Visual Studio (important)
  2. Go to [solution folder]\.vs\[solution name]\v14
  3. Delete the .suo file
  4. Start Visual Studio

Upvotes: 10

Jimmy
Jimmy

Reputation: 5241

It turns out that closing all open files, then shutting down Visual Studio, and restarting fixed the issue. pff!

Upvotes: 8

Related Questions