简体   繁体   English

Visual Studio 2017代码编译,但nuget包是红色下划线

[英]Visual Studio 2017 code compiles, but nuget packages are red underlined

After reinstalling my PC, including VS, my code compiles, but certain nuget packages' using statements (and thus, lines using the package too) are underlined with a red error as if the package was not referenced. 重新安装我的电脑,包括VS后,我的代码会编译,但是某些nuget软件包的使用语句(因此,使用软件包的行也是下划线)带有红色错误,就好像没有引用软件包一样。 However, the code compiles just fine. 但是,代码编译得很好。 While this could be just an annoyance, pausing the code and modifying even just a space in a comment now does not let me continue like it used to. 虽然这可能只是一个烦恼,暂停代码并修改注释中的空格现在不会让我继续像过去那样。

I'm sure I'm just missing some cache clear somewhere, but so far I have not found a solution. 我确定我只是遗漏了某些缓存,但到目前为止我还没有找到解决方案。 VS clean/rebuild, clean and re-open VS, bin/obj folder deleting did not help, restoring nuget packages says there is nothing to restore. VS清理/重建,清理并重新打开VS,bin / obj文件夹删除没有帮助,恢复nuget包说没有什么可以恢复。

Try closing Visual Studio and then delete the .vs directory that is at the solution level. 尝试关闭Visual Studio,然后删除解决方案级别的.vs目录。 I had the exact same symptoms as you and that was the only thing that fixed it for me. 我有与你完全相同的症状,这是唯一能解决它的问题。

声明:本站的技术帖子网页,遵循CC BY-SA 4.0协议,如果您需要转载,请注明本站网址或者原文地址。任何问题请咨询:yoyou2525@163.com.

 
粤ICP备18138465号  © 2020-2024 STACKOOM.COM