title: MSBuild error: The type or namespace name does not exist in the namespace error only when build with OutputDirectory
body: <p>I have a c# project that is referred in 2 Solutions, both the solutions have respective executable projects in .Net framework 4.6. When I try to build the solution and respective projects using MSBuild without Output Directory, both solution builds fine. </p>
  
  <p>However, when I try to build the solution and respective projects using MSBuild with Output Directory, solution1 builds successfully but solution 2 fails with an error:</p>
  
  <blockquote>
    <p>(CoreCompile target) ->
      ConfigurationProvider.cs(1,24): error CS0234: The type or namespace name 'Helper' does not exist in the namespace 'Shared' (are you missing an assembly reference?) [C:\Code\Shared\Shared.Configuration\Shared.Configuration.csproj]</p>
  </blockquote>
  
  <p>I have tried to explain the scenario below:</p>
  
  <p>Scenario1:</p>
  
  <blockquote>
    <ul>
    <li>Solution: Sol1</li>
    <li>Executable project: Sol1ExecProject, in .Net framework 4.6</li>
    <li>Classlibrary1(referred by Sol1ExecProject): SharedCL1, in .Net framework
    3.5 </li>
    <li>Classlibrary2(referred by CL1): SharedCL2, in .Net framework 3.5</li>
    </ul>
  </blockquote>
  
  <p>Scenario2:</p>
  
  <blockquote>
    <ul>
    <li>Solution: Sol2</li>
    <li>Executable project: Sol2ExecProject, in .Net framework 4.6</li>
    <li>Classlibrary1(referred by Executable project): SharedCL1, in .Net framework
    3.5 </li>
    <li>Classlibrary2(referred by CL1): SharedCL2, in .Net framework 3.5</li>
    </ul>
  </blockquote>
  
  <p>The project failing is a SharedCL1 as shown above and it complains about not finding namespace in SharedCL2. This issue is happening when I execute MSBuild command to build by specifying an OutputDirectory. If don't specify output directory, it builds successfully.</p>
  
  <p>Can somebody help me on what the issue is? Also, let me know if you need any other information on this. </p>
  
  <p>Things I have tried:</p>
  
  <ul>
  <li>I changed the .Net Framework of both shared projects to 4.6 --> Same result</li>
  </ul>