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

Viewed 497

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. 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.

1 Answers

Try closing Visual Studio and then delete the .vs directory that is at the solution level. I had the exact same symptoms as you and that was the only thing that fixed it for me.

Related