Sometimes ReSharper incorrectly identifies success

2019-08-22 05:19发布

Sometimes, after updating NuGets, ReSharper marks specific lines as errors, even though the solution builds, due to inability to recognize the type in use e.g. marks methods or properties in red, marks usage of object in red. In these cases the ReSharper intellisense is broken too.

In these cases sometimes reanalyzing all files in the "Errors in Solution" window and cleaning, closing Visual Studio, deleting the .suo file, reopening Visual Studio and Solution and building does not help.

Is there any way to fix this?

1条回答
欢心
2楼-- · 2019-08-22 06:06

I encountered this a few times, in all these cases, editing the .csproj file with the code misidentified as erroneous and modifying the references to the assemblies with the types not recognized from:

<Reference Include="AssemblyNameGoesHere, Version=1.0.0.0, Culture=neutral, processorArchitecture=MSIL">
  <HintPath>..\packages\AssemblyNameGoesHere.1.3.0\lib\net45\AssemblyNameGoesHere.dll</HintPath>
  <Private>True</Private>
</Reference>

to

<Reference Include="AssemblyNameGoesHere">
  <HintPath>..\packages\AssemblyNameGoesHere.1.3.0\lib\net45\AssemblyNameGoesHere.dll</HintPath>
</Reference>

Solved this issue.

I reached this solution by comparing the .csproj files of the project with the "errors" other projects in the solution containing similar code that is was not marked as erroneous by ReSharper.

查看更多
登录 后发表回答