title: Resolving dependent projects
body: <p>msbuild and Visual studio seem to resolve project dependencies differently: a solution file contains the project for the main executable, and some projects for dlls the executable depends on. One of these dll projects depends on another project which is not part of the solution.</p>
  
  <p>Just to show the major players in this case, and a simple way to reproduce it:
  solution contains ExeProject and MainDllProject, MainDllProject depends on SubDllProject which is not part of the solution (but in the same hierarchy on the file system). ExeProject depends on MainDllProjectClass1 of MainDllProject (that class does not depend on SubDllProject; only MainDllProjectClass2 depends on SubDllProject, but it is not used by ExeProject nor MainDllProjectClass1):</p>
  
  <pre><code>Solution
      ExeProject
          Form1 (depends on MainDllProject.MainDllProjectClass1)
      MainDllProject
          MainDllProjectClass1
          MainDllProjectClass2 (depends on SubDllProject.SubDllProjectClass)
  Not part of the solution
      SubDllProject
          SubDllProjectClass
  </code></pre>
  
  <p>When the solution is built with Visual Studio 2010, it fails: MainDllProject cannot be built because SubDllProject cannot be found.</p>
  
  <p>When the solution is built with msbuild, the build succeeds. Strangely, the debug version of SubDllProject is built despite the parameter /p:Configuration=Release.</p>
  
  <p>The log file for msbuild is some 374 kB, do you have some hints how to analyse it? I want to understand why it builds SubDllProject at all, why it is the debug version, and evetually how to prevent it from being built when not referenced (I want the the solution to contain all referenced projects, and when a dependency was forgotten, I want to see an error message).</p>
  
  <p>Note: this case is similar to <a href="https://stackoverflow.com/questions/12836023/visual-studio-build-non-dependent-projects-in-solution">Visual studio build non-dependent projects in solution</a>, but quite the other way round...
  I understand from <a href="http://blogs.msdn.com/b/visualstudio/archive/2010/12/21/incorrect-solution-build-ordering-when-using-msbuild-exe.aspx" rel="nofollow noreferrer">http://blogs.msdn.com/b/visualstudio/archive/2010/12/21/incorrect-solution-build-ordering-when-using-msbuild-exe.aspx</a> that msbuild translates the sln file into its own format - but the sln.metaproj file does not show any reference to SubDllProject either.</p>