Visual studio - getting error "Metadata file 'XYZ' could not be found" after edit continue

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.

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

Update 2019:
This question got a lot of traffic in the past, but it seems that since VS 2017 was released, it got much less attention.
So another suggestion would be - Update to a newer version of VS (>= 2017) and among other new features this issue will also be solved


As far as I can tell, this happens when the project dependencies gets messed up for whatever reason (whilst all the inter-project references are still intact). For many cases, it is NOT a code issue. And for those who have more than a few projects, going through them one at a time is NOT acceptable.

It's easy to reset project dependencies -

  1. Select all projects and right click unload
  2. Select all projects and right click reload
  3. Rebuild solution

For those who have an issue in their code or some other issue that's causing this problem you'll obviously have to solve that issue first.


One possible reason could be you have upgraded the some of your projects (in the solution) to higher version e.g. from .NET 4.0 to 4.5 This happened in my case when I opened the solution in VS 2013 (originally created using VS 2010 and .NET 4.0). When I opened in VS 2013 my C++ project got updated to .NET 4.5 and I started to see the problem.