title: The type 'X' does not exist in the type 'Y.Z'
body: <p>Our team has recently migrated from Visual Studio 2008/.NET3.5 to Visual Studio 2010/.NET4.0. Now, VS2010 gives me a strange error message. It's reproducible with the following program:</p>
  
  <pre><code>using System;
  
  namespace Some.Main
  {
  }
  
  namespace SomeLib
  {
      interface Some
      {
      }
  }
  
  namespace ConsoleApplication1
  {
      using Some.Main;
      using SomeLib;
  
      class Program
      {
          static void Main(string[] args)
          {
              Console.Write("Press enter to continue");
              Console.ReadLine();
          }
      }
  }
  </code></pre>
  
  <p>This worked just fine in VS2008, but in VS2010 I get the following error message:</p>
  
  <blockquote>
    <p>The type name 'Main' does not exist in the type 'SomeLib.Some'</p>
  </blockquote>
  
  <p>Interestingly, if I hit 'Build Solution', the program builds just fine, and I can even execute it without any problems. It's just Visual Studio that seems to have a problem with this code.</p>
  
  <p>Unfortunately, I'm working on a large-ish legacy application and I cannot (easily) change the names of these namespaces.</p>
  
  <p>I'd like to know how I can fix this error, and I'm also curious what causes it.</p>