ReSharper Marked Classes in Red Color Issue
I have encountered an issue: solution can be successfully built and run, but lots of classes in the VisualStudio are marked as red color by ReSharper. Clean and rebuild the solution doesn't work. Something like this: Everything compiles, but Resharper marks everything in red?
Clean ReSharper Cache
The following instructions are tested under Resharper Ultimate 2019.2:
Visual Studio > ReSharper > General > Options > General > Clear Caches
"Restart" ReSharper:
Visual Studio > Tools > Options > ReSharper Ultimate > Suspend Now/Resume Now
If this operation doesn't resolve the issue, continue reading...
VisualStudio Clean Build
VisualStudio's solution clean doesn't remove bin/ and obj/, which might lead to some weird build or runtime errors. In our case, it seems that ReSharper still uses old assembly. Specifically, when you change a project from dotnet framework to dotnetstandard or dotnetcore, the issue frequently happens. Therefore, a REALLY CLEAN BUILD should be performed. (How to clean Visual Studio bin and obj folders)
To make a clean build, commit all changes and execute:
$ git clean -fdx
Warning! This command is DANGEROUS, it will delete all untracked files. (bin/, obj/, etc.)
What these options mean: (https://git-scm.com/docs/git-clean)
-d Normally, when no
is specified, git clean will not recurse into untracked directories to avoid removing too much. Specify -d to have it recurse into such directories as well. If any paths are specified, -d is irrelevant; all untracked files matching the specified paths (with exceptions for nested git directories mentioned under --force) will be removed. -f --force If the Git configuration variable clean.requireForce is not set to false, git clean will refuse to delete files or directories unless given -f or -i. Git will refuse to modify untracked nested git repositories (directories with a .git subdirectory) unless a second -f is given.
-x Don’t use the standard ignore rules (see gitignore[5]), but still use the ignore rules given with
-e
options from the command line. This allows removing all untracked files, including build products. This can be used (possibly in conjunction with git restore or git reset) to create a pristine working directory to test a clean build.
After the git clean, rebuild the solution and wait resharper finish processing the assembly. Then the red color warnings disappear. :-)