Logo Questions Linux Laravel Mysql Ubuntu Git Menu
 

No compile errors when reference added, but errors seen upon build

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.

like image 325
cjs Avatar asked Jul 14 '26 20:07

cjs


1 Answers

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.

like image 105
Greg Beech Avatar answered Jul 17 '26 18:07

Greg Beech



Donate For Us

If you love us? You can donate to us via Paypal or buy me a coffee so we can maintain and grow! Thank you!