views:

23

answers:

1

A solution was just converted from VS 2008 to VS 2010. My VS 2010 build is failing with the popular "The type or namespace X could not be found". When I go to the project and go to Add References and add the appropriate project dll, the class name appears in blue text as if .NET found the correct class. However, when I go to the Build menu and select "Build Solution" I get the "namespace not found error" and the class name is no longer blue.

Thanks.

+1  A: 

Your project is probably using the .NET 4.0 Client Profile, rather than the full .NET 4.0 framework.

Go to Project > Properties > Application and set "Target framework" to .NET Framework 4.

For some reason Microsoft set this as the default framework instead of the full one for projects in VS2010, and compilation fails with this cryptic error message for any referenced types/namespaces in assemblies which were built against the full framework.

Greg Beech
I checked that and all projects are set to .NET Framework 4. :(
cjs
Ah, in that case I don't know I'm afraid. This is the one I've run into a whole bunch of times. I'd imagine it's something similar like the wrong version of a DLL being referenced (e.g. still referencing an old mscorlib or something) but that's a pure guess.
Greg Beech