views:

161

answers:

1

I have a large solution containing many C# projects. When I open the solution and hit F5 for the first time, I get compile errors like the following:

Error 3 Metadata file 'C:\Users\david\Documents\VS.Projects\CeoTrunk\Ceoimage\bin\x86\Release\Ceoimage.dll' could not be found.

I'm compiling the solution and the projects producing the error for "Debug (Any CPU)" and I haven't selected "Release (x86)" for a long time. Maybe months. These errors go away after I build the solution for "Debug (Any CPU)" the first time. If I close the solution and hit F5 again, the problem reappears.

Where could this "Release (x86)" remnant be hiding? How do I get rid of it? Why does it keep coming back?

+2  A: 

Without seeing your solution and project files, here is what I suggest.

  1. Clean out ALL obj and bin directories (preferrably, delete your source and get a fresh copy).
  2. Try a full build and see if it still fails. If it does...
  3. Repeat step 1.
  4. Check your references for each project and make sure they reference other projects as project references rather than a direct reference to their output assembly.
  5. Try unloading projects and rebuilding to see if you can identify the offending item.

Unfortunately, it could come down to a cyclic dependency or some other convoluted dependency tree that means Visual Studio is struggling to determine a valid build order, hence requiring multiple builds to complete the process.

Jeff Yates
I believe the problem has more to do with VS 2008 than with the solution and project structure, as our build server cleans up after itself and always builds without issue. But deleting my working copy and building from scratch worked fine, so your advice is what pulled me through to victory.
flipdoubt
I'm glad you solved it. I hate build issues like this because they break your flow right when you're probably about to solve something.
Jeff Yates