Logo Questions Linux Laravel Mysql Ubuntu Git Menu
 

ReSharper "Cannot resolve symbol" even when project builds

My Tools:

Visual Studio 2012 Ultimate + Update 1

ReSharper v7.1.25.234

My Solution Build Status: Build Successfully

But when I install ReSharper and ReSharper code analysis is enable, many keywords of my code are red with this error:

"Cannot resolve symbol XXX"

Enter image description here


Another picture of my project >>

The ReSharper “CANNOT RESOLVE SYMBOL” errors are everywhere, but my project build process is successfully, and it works correctly.

Enter image description here

Additional Note: If I disable ReSharper Code Analysis, my project will be Normal, but I want to use ReSharper code analysis.


I tried ReSharper → OptionsGeneralClear Cache. But I still have this problem!


  • One month ago, I got these errors when I uninstalled Visual Studio 2012 RC and installed VS 2012 RTM.

  • I've already uninstalled and installed ReSharper again. But I have this problem yet!

  • My solution has five projects >> two loaded projects (main project + resource project) and three unloaded projects


I realize that my Visual Studio also has bigger problems (More information on Stack Overflow)

  • I can't add any reference to my projects (even inside new solutions and new projects)

  • I can't install any package (by "Packet Manager Console" or Manage NuGet Package)

  • I can't update any package (by "Packet Manager Console" or Manage NuGet Package)

I've done a lot of suggestions (of myself and others)

  • Re-resister some DLL files

  • Using some windows and registry repair tools

  • Remove ReSharper

  • Repair Visual Studio

  • and...

But I could not solve it.

I'm thinking of installing a new Windows :(


What is wrong, and how can I fix it?

like image 418
Ramin Bateni Avatar asked Mar 29 '13 23:03

Ramin Bateni


5 Answers

Try Visual Studio → menu ToolsOptionsReSharper, Suspend button and Resume again (no need to close the window). This works in my case.

like image 136
Lu55 Avatar answered Nov 04 '22 20:11

Lu55


VS -> Tools -> Options -> ReSharper Suspend button 
Clear Contents of -> AppData\Local\JetBrains\ReSharper\v7.1\SolutionCaches
VS -> Tools -> Options -> ReSharper Resume  button
like image 45
Marcel Avatar answered Nov 04 '22 19:11

Marcel


This worked for me (VS2012u4, R# 7.1.3):

  1. Resharper > Options > Environment: General > Clear Caches
  2. Restart Visual Studio
like image 25
Jeroen K Avatar answered Nov 04 '22 19:11

Jeroen K


Clear Resharper cache: Resharper -> Options -> General -> Clear Caches, close and reopen the solution. It worked in R# 9.0 Update 1

like image 33
Dio Phung Avatar answered Nov 04 '22 21:11

Dio Phung


This happens in ReSharper when you have two different versions of the same library in your solution. For example project A references automapper version 1.1 and project B references automapper version 1.0.

Visual Studio will often compile and run as expected in the situation as it chooses one of the DLLs to bind to. However ReSharper gets massively confused. For me this should be a ReSharper error that it asks you to resolve rather than just going bonkers.

UPDATE:

I ran into this two days ago (a day after I made this post) by total coincidence and came across this link where they say that it is caused by a bug in the VS API. I tried everything that they recommended and was unable to resolve it even temporarily: I had Autofac 2.6.x that I'd downloaded from google.code and then swapped it over for the NuGet package version and it willfully refused to see the new reference no matter what I did.

They suggest installing the R# 8 EAP but for me it was less hassle to just downgrade to the old version of Autofac.

Not much in the way of help, but maybe useful.

like image 31
satnhak Avatar answered Nov 04 '22 20:11

satnhak