ChatGPT解决这个技术问题 Extra ChatGPT

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"

https://i.stack.imgur.com/mtS8B.jpg

Another picture of my project >>

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

https://i.stack.imgur.com/IUkrX.jpg

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

I tried ReSharper → Options → General → Clear 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?

I had the same issue once. Had to unistall it and install it again.
@Marco, I've already uninstalled and installed it again. But has not solved.
Any of the solutions below will work, temporarily. The problem always comes back and is especially bad if you're also using TFS for version control. Silence from JetBrains and lack of updates in the past year makes me think they are lazily riding the R# money train.
In my case, none of the answers here have worked. I've also gone through Jetbrain's support but they haven't been able to help as yet. I've simply had to disable Resharper for the time being. Issue tracked here.
It's Jan 2021 and this problem still exists! =|

P
Peter Mortensen

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


On VS2012 Update 3 with Resharper 7.1.3 and this didn't resolve my issue. Uninstalling Resharper and reinstalling fixed it for me.
This didn't work for me but clearing ReSharper Caches solved the problem.
I had to clear cache and suspend ReSharper VS2012 update 4 and R# 7.1
This didn't work for me either, but unloading/reloading the project did: right-click the project->Unload Project, then right-click again->Reload Project.
Same solution with clear cache (necessary in some cases): stackoverflow.com/a/19772172/2387977
M
Marcel
VS -> Tools -> Options -> ReSharper Suspend button 
Clear Contents of -> AppData\Local\JetBrains\ReSharper\v7.1\SolutionCaches
VS -> Tools -> Options -> ReSharper Resume  button

You can do Resharper > Options > Environment > General Click 'Clear Cashe' and then restart VS. Ty for the answer, helped me.
This worked for me :) other way to do it by Clear Cache from Visual studio itself ty
Clearing the cache didn't work for me. Deleting the content of the SolutionCaches folder did.
This works for me to resolve an annoying "Cannot resolve method" warning. To add on, for resharper 9 in VS2013 the path is \AppData\Local\JetBrains\Transient\ReSharperPlatformVs12\v01\SolutionCaches
To add on again, this time for Resharper 10 in Visual Studio 2015, the path is %localappdata%\JetBrains\Transient\ReSharperPlatformVs14. I had v02, v03, and v04 subfolders in there - I deleted all of them and their contents.
J
Jeroen K

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

Resharper > Options > Environment: General > Clear Caches Restart Visual Studio


D
Dio Phung

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


The menu option was General not "Generate" to get to Clear Caches
Doesn't appear to work in a .NET Core project for R# 9.2? Tried closing and reopening project, and VS... EDIT: It works now! For some reason had to restart twice before it worked!
thanks! this is the only solution that worked for me using VS 2017 Professional.
s
satnhak

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.


i edited my question with additional info about the extent of errors. 1 month ago, i changed my vs 2012 RC to vs 2012 RTM and this errors happened (without any change in my project). Now, what is your recommendation?
Have you tried deleting all references and then re-adding them (you could be pointing at the old DLLs and that is confusing R#).
I realize that my Visual Studio also has bigger problems: I can't add any reference to my projects (even inside new solutions and new projects), more info: stackoverflow.com/questions/15746529/…
This got me going in the right direction after the accepted answer didn't work. For me, the library in question had an update available. I was planning on removing it and then adding it back in again, but I saw the update and tried that first. After updating the library, the issue worked itself out.
This answer helped me with a similar situation. I referenced the AspNetCore.Mvc version 1.0.0 rc final in my project.json file which caused the issue the OP was seeing. I went back into the project.json file and changed the version to 1.0.0 which fixed the issue
S
SharpC

This was happening to me with Visual Studio 2015 and ReSharper Ultimate 10.0.2. I tried pretty much all the solutions written prior to this answer (apart from any reinstallations) and nothing worked.

I got it working again with a variety of the above steps in a very specific order:

ReSharper → Options → Environment → General → Clear Caches this must be done before suspending ReSharper as otherwise this option is unavailable this clears out the files in C:\Users\YourUsername\AppData\Local\JetBrains\Transient\ReSharperPlatformVs14\v04 as mentioned in some other posts Tools → Options → ReSharper Ultimate → Suspend Close Visual Studio this actually performs the ReSharper cache clear Open Visual Studio Open the solution I waited for Visual Studio to detect there were no code issues in IntelliSense and may have performed a build at this point. Tools → Options → ReSharper Ultimate → Resume

Hopefully after the last step you can breathe a sigh of relief that you don't have to reinstall anything, I certainly did!


This also happened with Visual Studio 15 Preview and Resharper. These steps fixed the problem for me (hopefully it won't come back any time soon). Thanks!
VS 2017 here. It was the clearing of cache; shut down VS and restart; suspend Resharper and close VS; restart VS in solution and then start Resharper that did it for me.
Clear cache and restart project solved the issue. Thanks!
G
Grey Wolf

It's usually happen by config file corrupt or wrong detect. Just delete .vs folder, restart VS to reset config. It will work almost case

https://i.stack.imgur.com/Qgrus.png


n
nils

I had similar problems and cleared the caches found at:

AppData\Local\JetBrains\ReSharper\v7.1\SolutionCaches

Solved the problems for me

Running VS2012 u3


I did something similar, I just deleted the entire AppData\Local\Jetbrains directory. I had a LOT of different versions in there including some that were newer than my current resharper install.
M
Mikołaj Mularczyk

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.


Unbelievable, this was the cause of the problem for me too. I cannot believe it... this should definitely get more upvotes.
Agree helped me too
targets had no impact in resolving this issue for me.
Agree with above, especially as you get a warning in the Error List window telling you that this is the problem. People should check this before fiddling around with Resharper.
Thanks Mikolaj. Same issue here.
S
SharpC

Above links of clearing the cache and/or suspending the ReSharper did not work for me. I just 'refreshed' the project, which was showing this problem, from the solution explorer and the problem goes away. Sadly, it keeps on recurring and only option it to keep on refreshing every time this problem recurs.

I have VS2012 with ReSharper 8.1 on Windows 8


How do you "refresh" the project?
Right click on the project in Solution Explorer -> Refresh
This solved the issue for me as well with VS2017 and R# 20127.3 EAP 9
Refreshing did nothing at all for this issue for me.
P
Pang

As you see, the solution is what everyone has already mentioned - simply by Suspending ReSharper, then Clearing the Caches, and finally Resuming it. But, no one mentioned how to do it without closing/restarting Visual Studio.

Just follow these steps:

Getting ReSharper Cache Location Manually by going to ReSharper Options > Environment > General > Store Solution Caches in (Combo Box) (marked 2 in the image). Selecting Custom Folder, then Copying the location of the Caches Folder from the text box shown (marked 3 in the image). Reverting the settings back. The 1 marked shows the ClearCache Button. It's usually wouldn't work so leave it. Suspending ReSharper You can do this by going to Tools > Options > ReSharper Or ReSharper Ultimate > Suspend Now (Button) Clearing the Cache Go to the location copied earlier in step 1 and delete everything in that folder. And yes, I do mean everything. Resuming ReSharper You can do this by again going to Tools > Options > ReSharper Or ReSharper Ultimate > Resume (Button)


Thanks! This is literally the only thing that worked for me. Resharper is beginning to be more of a problem than a solution these days.... so slow and buggy....
All this did nothing to resolve the issue. Deleting Reshaper fixed the problem
J
James Thurley

I was just having the same issue with ReSharper 8.2 in Visual Studio 2013, and none of the usual solutions here of clearing caches, suspending ReSharper or re-installing ReSharper was working.

In my case I ended up solving it as follows... I looked at one of the symbols that it couldn't resolve and noted it was in System.Web.Http.dll. I then found that this was in the Microsoft.AspNet.WebApi.Core NuGet package. I used the package manager console to try and uninstall that package, except of course it told me that it couldn't due to other dependencies.

So I uninstalled each dependency up to and including Microsoft.AspNet.WebApi.Core, and then re-installed each package again in the reverse order. ReSharper picked everything up correctly as it was installed, and now seems fine.


Worked for me too. Just uninstall the nuget packages for the project, and reinstall them.
None of these worked for me especially playing with web api. did nothing
The last thing im going to do is delete dependencies of a project to get a poorly written app to work . I oped to delete resharper. problem solved and VS is much faster now.
T
Teoman shipahi

I had the same issue and unloading and reloading problematic project helped me to clear out this issue for ReSharper. Hope this helps.


Updating VS, updating resharper, clearing cache automatically and manually and suspending resharper didn't help me. It's not a resharper issue, it is probably a VS bug. This worked for me. Thanks.
This did nothing what so ever. Pretty much like "refresh" which also did nothing.
S
StackOverflowUser

I ended up needing to request Resharper to clear its cache along with doing it manually through Windows File Explorer. This finally resolved the issue for me.

(As reported in many of the solutions here) RESHARPER > Options... > Environment > General > Clear Caches. Close Visual Studio. Go to this path in File Explorer for Resharper 10 in Visual Studio 2015: %localappdata%\JetBrains\Transient\ReSharperPlatformVs14 Delete all subfolders and their contents within that folder. Restart Visual Studio, reload your Solution and wait for Resharper to initialize itself for the Solution.


D
Dib

For me for VS2015, I had to update Resharper to version 2016.2.2 to resolve the issue.

I had already tried (of which none worked for me):

suspending / resuming

suspending / clearing cach (using tools > options button) / resuming

suspending / clearing cach (using Windows file system) / resuming

moving cache to solution folder / restarting visual studio

many other combinations of all or some of above

I hope that may help someone.


this is just a copy paste of ther options. all did nothing to resolve the issue.
@Mike - Please feel free to link to the "other" post which advises updating R# to 2016.2.2, as I cannot see it.
V
Victor Gelmutdinov

Resharper -> Options Caches -> Store solution caches in: (Change folder to another one).

Or try to manually clean up R# cache folder


r
ragnar

I'm using 7.1, and this worked for me:

Uninstall resharper go to %appdata% and remove JetBrains\Resharper and ..\Local\JetBrains\Resharper folders re-install resharper


r
rythos42

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.


C
Community

I my case, I tried all the suggestions above. But, at some point I realized that the problem persists even if Resharper is suspended. So, I looked for similar problem in VS itself and found the solution in the comments for the accepted answer in this SO post.

I'm listing my steps for brevity.

VS -> Tools -> Options -> ReSharper Suspend button Build solution. Notice all references still unresolved Clean the solution Restart VS Build the solution without Resharper. Notice all references resolved VS -> Tools -> Options -> ReSharper Resume button


B
Bob

None of the cache cleanup worked for me. All of the symbols in any of our private NuGet repros just stopped being picked up with R# enabled, very frustrating. I got this feedback from JetBrains support, which DID work, after toggling and restarting VS2019:

disable the following option - ReSharper | Options | Environment | General | Read solution model directly


Finally, an answer that works after hours of suffering!!! Thanks...
Thanks for this useful tip. Great works for me..
a
anish

I am using VS2015, R#10. None of the suggested solution worked for me. I deleted the contents of the bin folder of my solution and rebuild the entire solution, that seems to have resolved the issue. Before deleting the contents of the bin folder, I had tried suspending and resuming R#, doing clear cache from R# -> option -> general setting, and also manually deleting the contents from \AppData\Local\JetBrains\Transient\ReSharperPlatformVs12\v01\SolutionCaches.. Hope it helps someone.


A
Ashraf Alam

I was having the same issue in my Visual Studio 2015 with Resharper Ultimate and tried the solutions as suggested above, but none worked for me.

Then upgrading Resharper to latest release solved my issue.


Yeah I've also come to the same conclusion. Unfortunately my R# subscription has run out which means I have to pony up another $400-$500 in order to upgrade my R# version to fix the error...
B
Birgit Vera Schmidt

What helped in my case after several of the suggestions above didn't:

Removed one project reference (of one of the libraries where ReSharper claimed not to be able to find it even though it was correctly referenced).

Use ReSharper’s "Resolve" on one of its usages to add the reference again.

After that, it worked fine, even though none of the project files were actually modified in the process.


y
york

I have the same problem.Clean Resharper cache and Suspend Resharper not worked for me.I just close visual studio, uninstall Resharper,and then install Resharper,the problem was gone.


J
Jorn.Beyers

I was referencing a NetStandard2.0 project that didn't get recognized by R#. I cleared the caches but that did not help me.

Downloading the latest version and updating R# did work for me.

This is the version I'm now running:

JetBrains ReSharper Ultimate 2017.3.2  Build 111.0.20180201.63358
ReSharper 2017.3.20180201.111630

Just download R# and it will recognize already installed versions. Updating to the latest version is really easy.


B
Bork Blatt

When I disabled ReSharper, Visual Studio was also giving the same error, even though the project built successfully. What I did to resolve the issue was:

Remove the project from the solution. Right-click the solution, Add Existing Project, select the project file and add it again.

After performing these steps, the syntax errors went away in Visual Studio, and after I enabled ReSharper again, it also had no errors.


My errors were all references related to a single nuget package. I removed and re-added the package. Errors gone. Thanks for the pointer.
R
Richardok

I also had this problem. All previous solutions did not help for me or helped for a very short time. In my case, the problem was that I connected the .Net Framework 4.7.2 project to a project that has version 4.5.2. After I updated both projects to version 4.7.2, the problem was resolved. I think that to solve the problem you need to have the same version of the projects. Or connect a smaller version to a larger one, but not vice versa, as was the case in my case.


Isn't this the same solution that @Mikołaj Mularczyk already suggested in his answer?
J
JohnFF

In Rider 2020.3 I just did a Build -> Clean, and then it worked.


H
HotN

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.


S
Scott Huddleston

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.