The type or namespace could not be found aka corrupt nuget packages

The type or namespace could not be found error when you have changed litterally nothing

Normally a sign of a corrupt package, sometimes if you look under dependencies -> nuget -> {project name} you will see the project installed by there will not be a dll at the bottom of the folder.

Fix

  1. Remove the package under dependencies -> nuget -> {project name}
  2. Remove it's folder from %UserProfile%\.nuget\packages
  3. Install the package again
  4. Build

Could also try clear nuget packages via Tools -> NuGet Package Manager -> Package Manager Settings -> Clear All Nuget Cache(s) but this didn't seem to work for me.