有时ReSharper会由于错误而错误地识别成功编译的代码,并且智能感知被破坏 [英] Sometimes ReSharper incorrectly identifies successfully compiling code as errors and intellisense is broken

查看:170
本文介绍了有时ReSharper会由于错误而错误地识别成功编译的代码,并且智能感知被破坏的处理方法,对大家解决问题具有一定的参考价值,需要的朋友们下面随着小编来一起学习吧!

问题描述

有时候,在更新NuGets之后,即使无法构建解决方案,ReSharper也会将特定行标记为错误,原因是由于无法识别使用中的类型,例如将方法或属性标记为红色,将对象的用法标记为红色.在这些情况下,ReSharper的智能感知也被破坏了.

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.

在这些情况下,有时有时会重新分析解决方案中的错误"窗口中的所有文件并清理,关闭Visual Studio,删除.suo文件,重新打开Visual Studio和解决方案并进行构建.

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?

推荐答案

在所有这些情况下,我都遇到了几次,用错误地标识为错误的代码编辑.csproj文件,并使用无法识别的类型:

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>

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

解决了这个问题.

我通过将项目的.csproj文件与解决方案中包含错误代码(未被ReSharper标记为错误的)的其他项目中的错误"进行比较,得出了该解决方案.

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.

这篇关于有时ReSharper会由于错误而错误地识别成功编译的代码,并且智能感知被破坏的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持IT屋!

查看全文
登录 关闭
扫码关注1秒登录
发送“验证码”获取 | 15天全站免登陆