How to make ReSharper re-evaluate its assembly reference highlighting

46,439

Solution 1

Except for reinstalling, the only way to successfully clear the caches is to delete the files manually from your AppData directory.

Delete the solution folder that's giving you grief in the following locations:

  • %LOCALAPPDATA%\JetBrains\ReSharper\v7.1\SolutionCaches\
  • %LOCALAPPDATA%\JetBrains\Transient\ReSharperPlatformVsXX\vXX\SolutionCaches\ for newer versions.

Note that the version numbers in the paths may be different depending on the ReSharper version that is installed.

The XX in vXX and VsXX represents any number, because there might be multiple folders where the solution cache is stored.

Solution 2

Try unloading and then reloading the project.

To unload the project, right-click the project in the solution explorer, and select Unload Project. Then, right-click the project again and select Reload Project.

The issue continues to occur occasionally with the latest versions of ReSharper, but the fix seems to work for every version.

Solution 3

You could try clearing the ReSharper cache via menu ReSharperOptionsEnvironment/General → button Clear Caches.

Solution 4

This worked for me. There is no need to reload projects. You can do this from within Visual Studio.

  1. Clear the ReSharper cache via ReSharper, Options, General, click 'Clear Caches'.

    Resharper Options

    Resharper Clear Caches

  2. ReSharper, Windows, select 'Solution Errors'. This will launch the Solution Errors window. At the top of this window, click the button to 'Reanalyze Files With Errors/Warnings'.

    ResharperWindows

    Reanalyze Files With Errors

Solution 5

Open ReSharper - Options - Environment - General, scroll down to Msbuild access and select Obtain data from msbuild after each compilation.

This worked for me, using ReSharper 10.0.1 with ReSharper Build.

Share:
46,439

Related videos on Youtube

Ali Mst
Author by

Ali Mst

I am an IT Software Architect from Salt Lake City, Utah.

Updated on April 13, 2020

Comments

  • Ali Mst
    Ali Mst about 4 years

    I am creating a Prism Project Template, and the template works great. But after I create a project with the template some of the files look like this:

    Bad References

    Despite appearances, everything is just fine.

    If I do a Rebuild All I see that the solution builds with no errors:

    Rebuilt

    But the rebuild all does not get rid of the "errors" that are showing in the editor window. (Note that the actual error window does not show any errors.)

    I can clean, rebuild, close and open files, and it will not fix the highlighting.

    However, if I close the solution and re-open it, all is well:

    Works After Reload

    My Question:

    Ideally there would be a way for my template or my IWizard to tell ReSharper to reload the references for the highlighting.

    I know I can turn ReSharper off and then on again and that will fix it, but I would rather not do that.

    Is there a ReSharper command that just refreshes this stuff?

    • John Saunders
      John Saunders about 12 years
      Are you using ReSharper?
    • Ali Mst
      Ali Mst about 12 years
      @JohnSaunders - yes, 5.1
    • John Saunders
      John Saunders about 12 years
      I've seen ReSharper do this, so it may be a ReSharper bug, not a VS bug. I just recently saw this with version 6.1.
    • Ali Mst
      Ali Mst about 12 years
      @JohnSaunders - I confirmed that this is a ReSharper issue. I edited my question to re-target it towards ReSharper. Thanks for pointing me in the right direction!
    • Jura Gorohovsky
      Jura Gorohovsky about 12 years
      What versions of Prism, WPF/SL/WinPhone are you using in your project?
    • Ali Mst
      Ali Mst about 12 years
      @gorohoroh - I am using the latest Released versions of Prism and WPF. (My template is just for WPF).
    • CAD bloke
      CAD bloke about 9 years
      It's a bug in Visual Studio and Resharper, a classic stalemate. See youtrack.jetbrains.com/issue/RSRP-329698
  • Ali Mst
    Ali Mst about 12 years
    Alas, it still did not fix it... Thanks for the idea though.
  • Tilak
    Tilak almost 12 years
    i am facing similar issue, and it does not fix.
  • Ali Mst
    Ali Mst almost 12 years
    I just tired this too. It did not fix the issue. Resharper still marked errors, but it all compiled fine. Unloading and re-loading the project is the only workaround I can find. (Though I am told it is fixed in the latest version of resharper)
  • Felix C
    Felix C about 11 years
    After that, you need to restart visual studio. Then it will work.
  • Nameless One
    Nameless One over 10 years
    This path might be different depending on your Caches configuration. (See Resharper>Options>General)
  • Ali Mst
    Ali Mst over 10 years
    @PeterMunnings - While that may work, it is not a command like I was looking for. A manual step kind of defeats the purpose.
  • Peter Munnings
    Peter Munnings over 10 years
    Fair enough - but it definitely fixes the problem you're facing (and not just you...)
  • iggymoran
    iggymoran over 10 years
    True, there is no specific command, but this can become an automated process by wrapping the delete in a batch file and importing that command into Visual Studio. You can then assign a shortcut to it and then call ReSharper specific things such as Reanalyze all files.
  • Houman
    Houman almost 10 years
    The answer is correct. Close all your visual studio instances, delete %LOCALAPPDATA%\JetBrains\ReSharper\ [installed_version] \SolutionCaches.
  • Matt
    Matt over 9 years
    Did not work for me, even after restarting visual studio. Thanks however.
  • Matt
    Matt over 9 years
    Doesn't work for me with version 8.1 of Resharper. I still have the problem described.
  • Joel
    Joel about 9 years
    Where is this folder in the latest version of resharper? I can't seem to find the folder SolutionCaches.
  • bdukes
    bdukes about 9 years
    @Joel in ReSharper 9, with the introduction of the ReSharper Platform, it's been moved to %localappdata%\JetBrains\Transient\ReSharperPlatformVs12\v01‌​\SolutionCaches (as @brgerner mentions, you may want to click the Clear Caches button first before going this route)
  • Christopher Haws
    Christopher Haws over 8 years
    You can use Resharper -> General -> Clear Caches to clear the caches regardless of your cache location. You will need to restart Visual Studio after clearing your cache
  • Zerratar
    Zerratar over 8 years
    Worked for me, thank you. I had tons of projects in my solution and didnt want to unload/reload them all one by one :p Not sure why you got a downvote though.
  • Juliano Oliveira
    Juliano Oliveira over 8 years
    Work for me, Resharper 8.1 don´t have folder %LOCALAPPDATA%\JetBrains\Transient\......
  • testpattern
    testpattern over 8 years
    Looks like the reload causes resharper to re-scan. This seems easier to me than hunting for caches in the file explorer.
  • Guillaume Perrot
    Guillaume Perrot over 8 years
    Happened to me after downgrading a nuget package then upgrading again. Used this hint to fix.
  • Ed Landau
    Ed Landau over 8 years
    Did not work me for me. VS 2013, Resharper Ultimate 2015.2
  • Seb T.
    Seb T. over 7 years
    Worked with R# 10.0.2, without having to restart VS.
  • znn
    znn over 7 years
    I also cleaned the solution and rebuild it. Then I can switch back to the previous Msbuild access when it's working
  • John-Philip
    John-Philip about 7 years
    Works best if you close visual studio then do msbuild yourSolution.sln /t:clean then clean all resharper caches, save and then reopen your solution.
  • Rory McCrossan
    Rory McCrossan about 7 years
    This worked for me, although I did have to restart VS
  • Chrigl
    Chrigl almost 6 years
    I had no luck with all the "clean cache" tips. Then i tried this and it almost helped. My workaround was: Find the project with the issue - open the references - select the reference that was flagged as unknown by R# - Press F4 - change something in the properties, like "copy local from true to false, then back to true"
  • Jorn.Beyers
    Jorn.Beyers almost 6 years
    After clearing the cache and restarting Visual Studio. Make sure you clean the solution and rebuild the solution as well. After doing the clean and rebuild it worked for me.
  • Jorn.Beyers
    Jorn.Beyers almost 6 years
    After clearing the cache and restarting Visual Studio. Make sure you clean the solution and rebuild the solution as well. After doing the clean and rebuild it worked for me.
  • CodeHxr
    CodeHxr over 5 years
    I had a similar fix. I had to actually remove the reference from my project and re-add it. None of the other solutions worked for me.
  • shelbypereira
    shelbypereira about 4 years
    Very Useful! I had the same issue with VS 2019, and Resharper 2019.3, but in fact it was NOT an issue. The fact that the project builds does not necessary mean that Resharper will not find errors. In my case there were some errors in some xml test files in my NUnit project. This solution quickly found the files