Visual Studio - get an error & ldquo; The metadata file 'XYZ' could not be found & rdquo; after the edition continue


I have stumbled into an issue that is really annoying.
When I debug my software, everything runs OK, but if I hit a breakpoint and edit the code, when I try to continue running I get an error:
Metadata file 'XYZ' could not be found

After looking around for a while, I found some a similar issues, but they were all regarding a build failure, which is not my case (this happens only after edit-continue).

What I have tried so far:

  • My code is compiling and running.
  • I cleaned the solution and restarted VS.
  • I made sure that the missing file's project is being build for the configuration I am running (in configuration manager).
  • I manually built the missing file's project.

Some extra info:

  • It does not matter what I change, still get the same error (the change is not related to the missing file).
  • This happens also when I pause and continue (not only breakpoints)
  • I am running the project using a custom configuration (configuration manager...). When I run it using the default Debug configuration the error does not occur.

Any ideas?

Eventually what solved the issue was:

  1. Clean every project individually (Right click> Clean).
  2. Rebuild every project individually (Right click> Rebuild).
  3. Rebuild the startup project.

I guess for some reason, just cleaning the solution had a different effect than specifically cleaning every project individually.

As per @maplemale comment, It seems that sometimes removing and re-adding each reference is also required.