ReSharper “Cannot resolve symbol” even when projec

2019-01-03 07:25发布

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?

30条回答
Luminary・发光体
2楼-- · 2019-01-03 08:16

I did everything above with no fix.

Then I did a step from another SO Q/A (don't remember which one) which was to set System.Web.Mvc to Copy Local true. Recompile my project and the errors went away.

When I set this assembly back to Copy Local false, the errors didn't return.

查看更多
男人必须洒脱
3楼-- · 2019-01-03 08:17

We saw this problem as well, specific to files which were shared by multiple projects. There is a combo box in the upper left corner of the editor window that lets you switch project context for the file (and hence the references that impact symbol resolution).

Resharper makes it easy to accidentally open the wrong "version" of a shared file by its "go to file or symbol" commands.

Switching context back to the project I use in the solution was all I needed to do to fix this issue.

查看更多
兄弟一词,经得起流年.
4楼-- · 2019-01-03 08:18

For me, I think my solution just got caught in a weird state when I was changing which branch of my local Git repo I was on. Simply switching to the previous branch I was on before the problem started, telling VS to reload all the files, then switching back to the desired branch and reloading again fixed it.

查看更多
萌系小妹纸
5楼-- · 2019-01-03 08:20

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

查看更多
狗以群分
6楼-- · 2019-01-03 08:20

I had the same problem (VS 2017). In my case it was different versions of target framework - one assembly targeted 4.52, another 4.62 - after setting those to the same version in both assemblies it started working again.

查看更多
趁早两清
7楼-- · 2019-01-03 08:20

It should be a problem related to Resharper cache, but as far as I know, the "clear cache" feature works only if your cache is in Solution Folder. To check try this: Visual Studio > Tools > Options > Resharper > Options ...

In Resharper Options window > Environment > General check that "Store solution caches in" it's set to "Solution folder"

After this in solution folder you should see a new folder "_ReSharper.Caches". You should be able to clean it by pressing the "Clear caches" button, but (if this doesn't work) you can clean manually by removing inside files (in this case, Visual Studio has already to be closed).

Restart Visual Studio and everything should work. Have a look here [1] as well

[1] https://resharper-support.jetbrains.com/hc/en-us/articles/206546989-ReSharper-stopped-working-for-a-single-specific-solution

Note: Visual Studio 2015 Update 1 / ReSharper 10.0.2

查看更多
登录 后发表回答