How to make ReSharper re-evaluate its assembly ref

2019-01-12 14:50发布

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?

14条回答
老娘就宠你
2楼-- · 2019-01-12 15:25

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.

查看更多
我想做一个坏孩纸
3楼-- · 2019-01-12 15:27

Go to ReSharper → WindowsSolution Errors Window, and you will get an overview of the errors in your solution. There, you can click the button Reanalyze Files With Errors.

If you want, you can assign a shortcut to this. Go to ToolsOptionsKeyboard, and search for "Reanalyze". You can assign a keyboard shortcut to either 'ReSharper_ErrorsView_ReanalyzeAllFiles' or 'ReSharper_ErrorsView_ReanalyzeFilesWithErrors'.

查看更多
爷、活的狠高调
4楼-- · 2019-01-12 15:28

Run the following code in a command prompt. Then solve the ReSharper issue...

del /q/f/s %TEMP%\*
查看更多
再贱就再见
5楼-- · 2019-01-12 15:31

The only thing that helped me is: Unistall and than Install Resharper again (Repair didn't work)

Visual Studio 2010 SP1, ReSharper 7.1.3000.2254

查看更多
叼着烟拽天下
6楼-- · 2019-01-12 15:33

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.

查看更多
劫难
7楼-- · 2019-01-12 15:33

I have a similar issue with nuget packages and I found a most weird workaround: select the reference in project reference list and press 'F4'. Somehow properties window appearance causes resharper to reevaluate available references...

查看更多
登录 后发表回答