I was working on a Silverlight application and went to create a service reference to a WCF service. The files generated properly, but when I went to compile I got a few errors that looked similar to below:
The type name 'MyService' does not exist in the type
'MyProjectNamespace.MyProjectNamespace'
C:\..\Service References\MyService\Reference.cs
I though it was very strange because this is code that was generated by Visual Studio .NET 2008. After playing with it for a while, I decided to try creating the reference in another application with nothing in it. It worked perfectly. The problem I ran across has to do with naming issue. The reason it failed is because there was a class with the same name as the namespace of the project. For example, if the namespace is called EmployeeAdmin, and there is also an EmployeeAdmin class, everything will work until you create a service reference. It throws an error because the interfaces are generated in the reference.cs file and look like this:
public interface MyServiceChannel : EmployeeAdmin.MyServiceRefName.MyService,
System.ServiceModel.IClientChannel
{
}
The compiler is getting confused and thinks you are inheriting from a type within the EmployeeAdmin class rather than the EmployeeAdmin namespace. The only way to fix this, that I know of is to rename your class so that it doesn't match your namespace. I'm sure there's some documentation somewhere that says to never name a class the same as a Namespace. Under normal conditions, it wouldn't be a problem, but here's an example where it can be.
31fbede0-bf20-44b1-895e-5ed1b88b0968|1|5.0