How to fix an annoying ReSharper – NuGet error

Using NuGet in Visual Studio together with ReSharper may sometimes lead you into an annoying error where ReSharper indicates your code has an error, but the solution builds just fine.
This may happen if you have a set of NuGet packages, and you either just restore them, or delete them on disk and then restore again.  Your code ends up looking like this, note the red missing functions, which comes from the Moq library – which is downloaded from NuGet:



while the Build is still fine, it compiles without any errors:


This stackoverflow question gives some different approaches to solve this, but my experience have been that the Resharper Suspend-Resume trick most often solves the issue:
In Visual Studio:  Go to Tools/Options/Resharper

Press Suspend:


When this is done the error markers disappear, since ReSharper now is inactive.

Then just press Resume again:


This has been submitted to Jetbrains support,  here – Comment and votes please. 

About terje