How To Fix The Error 'xxx' is a 'namespace' but is used like a 'type'



TODO:

Have you ever gotten the dreaded message [ 'xxx' is a 'namespace' but is used like a 'type' ], even though you are using the fully qualified namespace?  For Example I have a Class named ProcessManager in the namespace ProcessManagerService.ProcessManager.  When I create a Console app, I try creating my object by saying:

ProcessManagerService.ProcessManager.ProcessManager pManager = new ProcessManagerService.ProcessManager.ProcessManager()

This statement will give the error above, when really I shouldn't.

 

 

SOLUTION:

In this case, if you look at the Properties of your project, you will most likely see the "Target Framework" is set to ".Net Framework 4 Client Profile".  Change that to ".Net Framework 4", and your build error will go away.

 

NOTES:

Information on the .Net Framework 4 Client Profile can be found at http://msdn.microsoft.com/en-us/library/cc656912.aspx



Comments (2) -

Tom Johnson
Tom Johnson
10/14/2012 3:14:02 AM #

Hey guys my 'Assembly Config' is already set to ".Net framework 4" and I still end up with the same error result.

I am attempting to access a web service and have established the link to this service using VS 2010 and 2012 express and still can't instanciate the objects. Are there other suggestions that may help resolve this issue?

Donnie Wishard
Donnie Wishard
10/14/2012 4:18:47 PM #

Can you post your sample code?  I assume you have the proper "using" statement also?

Add comment

  Country flag

biuquote
  • Comment
  • Preview
Loading