VS2010: “Type or namespace name could not be found”, problem & solution

12 Mar

I recently converted a VS2008 project to VS2010. An interesting probelm is that the project compiles and runs well in VS2008, however, when compiling in VS2010, errors occur:

“The type or namespace name  could not be found (are you missing an assembly reference?)… ”

Wow, what does this mean?

A search in Google shows that there are a lot of different explanations, but it seems there is no one that works, at least for my case.

Finally, I got the trick:

In the project properties, change the Dotnet framework from 2.0,3.0 or 3.5 to 4, compile and run!


Happy coding!


Posted by on March 12, 2010 in CAD, Dotnet/C#



25 responses to “VS2010: “Type or namespace name could not be found”, problem & solution

  1. Shoneen

    October 6, 2010 at 4:43 pm

    THANKS ! Worked for me.

  2. Sasikumar

    October 13, 2010 at 9:08 pm

    i am developing a website which includes to get sqlserver database values into excel sheet. i got a coding but i unable to import the namespace SECURITY. will u help me for my problem..

  3. rick

    November 23, 2010 at 5:51 pm

    Check the .cs properties – change from content to compile.

  4. xinyustudio

    November 23, 2010 at 8:06 pm

    Rick, nice comment. Thanks!

  5. baxxtab

    December 18, 2010 at 7:22 am

    Thank you!!! My problem was it defaulted to Framework 4.0 Client where my library was 4.0.

    Thanks Microsoft for your half-hearted help.

  6. citizhang

    December 30, 2010 at 6:03 am

    thank you!!! it saved me from trying to rebuild the whole solution!

  7. Liam

    January 14, 2011 at 7:55 am

    Thank you! I almost chewed off my own arm trying to figure out why my reference wasn’t being picked up.

  8. Tana

    June 16, 2011 at 2:52 pm

    It did not work with me

  9. Fernando

    July 20, 2011 at 3:16 am

    Gracias, a mi me funciono
    Windows Home x64
    MySQL Connector Net 6.4.3

  10. Stuart

    August 4, 2011 at 7:59 pm


  11. Guest

    October 1, 2011 at 2:48 am

    Thanks a lot.

  12. Maria

    November 2, 2011 at 11:05 pm

    Also watch to make sure you don’t have the Client Profile option selected unless you intended to! It seems to be the default, and has caused me problems before

  13. vnaresh

    November 28, 2011 at 7:10 pm

    still same error coming

  14. xinyustudio

    November 28, 2011 at 8:12 pm

    What are the specific errors? Do the comments above all fail?

  15. kismet

    January 10, 2012 at 1:12 am


  16. Ed.

    January 26, 2012 at 10:06 am

    Thanks! That did it.

  17. Gnanasekaran

    May 16, 2012 at 3:13 pm

    Thank u very much, u my god

  18. Jason Vickers

    June 13, 2012 at 2:35 am

    Thanks so much. This saved me some time.

  19. Inch

    November 7, 2012 at 3:41 am

    I have multiple projects in the solution. I have changed all to .Net 4.0 (not Client). I checked one of the .cs files giving the error and it’s already set to “compile”. I still have 645 – roughly 600 of which are namespace, the rest similar,

  20. Inch

    November 7, 2012 at 3:41 am

    645 errors I should have said.

  21. seema

    June 28, 2013 at 6:53 pm

    Thanks it worked for me

  22. Marcel Mateman

    July 24, 2013 at 5:35 pm

    Does some know how to develop in demo mode. I have problems with printing and creating the engine.


Leave a Reply

Fill in your details below or click an icon to log in: Logo

You are commenting using your account. Log Out / Change )

Twitter picture

You are commenting using your Twitter account. Log Out / Change )

Facebook photo

You are commenting using your Facebook account. Log Out / Change )

Google+ photo

You are commenting using your Google+ account. Log Out / Change )

Connecting to %s

%d bloggers like this: