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:17

For me none of the above worked. I had to install the new version of Resharper which supports NET Core 2.0.

查看更多
不美不萌又怎样
3楼-- · 2019-01-12 15:19

This is a strange issue, and is still alive and well in version 8.2.3 (build 8.2.3000.5176).

What seems to work for me on a consistent basis is to do a solution rebuild.

In VS 2013: Build -> Rebuild Solution

查看更多
走好不送
4楼-- · 2019-01-12 15:20

I am not certain this is the same root cause, but I discovered that, within the ReSharper options, "Use MsBuild" was checked and I got all sorts of erroneous errors reported. Try checking "ReSharper->Options->General" and see what state the "Use MsBuild" check is in.

查看更多
成全新的幸福
5楼-- · 2019-01-12 15:21

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.

查看更多
一纸荒年 Trace。
6楼-- · 2019-01-12 15:22

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

查看更多
仙女界的扛把子
7楼-- · 2019-01-12 15:25

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

查看更多
登录 后发表回答