Question: Every time I start Visual Studio 2008, the first time I try to run the project I get the error CS0006 The metadata file ... could not be found. If I do a rebuild of the complete solution it works.

Some information about the solution:

* I'm building in debug mode and Visual Studio complains about not finding dll:s in the release folder.
* The projects Visual Studio complains about are used by many other projects in the solution.
* I have changed the default output path of all projects to a ......\build\debug\ProjectName and ......\build\release\ProjectName respectively. (Just to get all build files in one directory)
* I have the same problem with a another solution.
* The solution was created from scratch.
* There are 9 projects in the solution. One WPF and 8 class libraries using dotnet 3.5.

Any ideas on what is causing this problem?

Answer: 
i had the similar issue where "metadata could not be found". on the solution property, make sure that the "build" check box is marked in *Build/Configuration Manager* for each project.
Deleting the entries of all source files which are no longer present in the source control and the file system from your .csproj file worked for me. 

---

**Detailed approach:**

Well, my following answer is not just the summary of all the solutions, but it offers more than that. 

**Section (1):**

**In general solutions:**

I had 4 errors of this kind (‘metadata file could not be found’) along with 1 error saying 'Source File Could Not Be Opened (‘Unspecified error ‘)'.

I tried to get rid of ‘metadata file could not be found’ error. For that, I read many posts, blogs etc and found these solutions may be effective (summarizing them over here):

1. Restart VS and try building again.
2. Go to **'Solution Explorer'**. Right click on Solution. Go to **Properties**. Go to **'Configuration Manager'**. Check if the checkboxes under **'Build'** are checked or not. If any or all of them are unchecked, then check them and try building again.
3. If the above solution(s) do not work, then follow sequence mentioned in step 2 above, and even if all the checkboxes are checked, uncheck them, check again and try to build again.
4. **Build Order and Project Dependencies:**

Go to **'Solution Explorer'**. Right click on Solution. Go to **'Project Dependencies...'**. You will see 2 tabs: **'Dependencies'** and **'Build Order'**. This build order is the one in which solution builds. Check the project dependencies and the build order to verify if some project (say 'project1') which is dependent on other (say 'project2') is trying to build before that one (project2). This might be the cause for the error.
5. **Check the path of the missing .dll:**

Check the path of the missing .dll. If the path contains space or any other invalid path character, remove it and try building again.

If this is the cause, then adjust the build order.

---

**Section (2):**

**My particular case:**

I tried all the steps above with various permutations and combinations with restarting VS few times. But, it did not help me. 

So, I decided to get rid of other error I was coming across ('Source File Could Not Be Opened (‘Unspecified error ‘)'). 

I came across a blog: 
<http://www.anujvarma.com/tfs-errorsource-file-could-not-be-opened-unspecified-error/#comment-1539> 

I tried the steps mentioned in that blog and I got rid of the error **'Source File Could Not Be Opened (‘Unspecified error ‘)'** and surprisingly I got rid of other errors **(‘metadata file could not be found’)** as well.

---

**Section (3):**

**Moral of the story:**

Try all solutions as mentioned in section (1) above (and any other solutions) for getting rid of the error. If nothing works out, as per the blog mentioned in section (2) above, ***delete the entries of all source files which are no longer present in the source control and the file system from your .csproj file***. 

---