Visual-studio – Error “Metadata file ‘…\Release\project.dll’ could not be found in Visual Studio”


Recently I started to get this message randomly:

Metadata file '…\Release\project.dll' could not be found in Visual Studio

I have a solution with several projects in it. The current build mode is Debug and all projects' configurations are set to Debug. But when I try to run the main project – sometimes it gives me a few errors, all of which are "Metadata file '…\Release\projectX.dll' could not be found" – and, look, it says about RELEASE folder, though current mode is Debug. Why? I tried to search for reference to "Release\projectX.dll" inside all solution files, and I found one in ResolveAssemblyReference.cache file.

I made a good search over the Internet and found a few people with a similar problem, but there was no solution, or at least no working solution.

I tried to delete references to those projects and read them, but in some time I start getting these errors again.

It seems like a bug. Why does it search for referenced projects in Release folders when I always use Debug mode?

PS. For those who met this problem: I couldn't solve it in an easy way. It disappeared only after I reinstalled Windows 🙁

Best Solution

Everyone is correct...try everything...(in order of a little to a lot of time wasted)

  1. Do you have bad code? Fix that first.
  2. Clean Solution & Restart Visual Studio
  3. Remove / Add References
  4. Check your build order w/ larger projects and verify
  5. Manually rebuild sub-projects
  6. Manually copy dlls between projects into associated bin folders
  7. Go get some coffee, play some pinball and come back may think of something else in the meanwhile.