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:
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();
}
}
}
This worked just fine in VS2008, but in VS2010 I get the following error message:
The type name 'Main' does not exist in the type 'SomeLib.Some'
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.
Unfortunately, I'm working on a large-ish legacy application and I cannot (easily) change the names of these namespaces.
I'd like to know how I can fix this error, and I'm also curious what causes it.