Theme:
v
How to solve error: The type or namespace name 'xxxxxx' could not be found

Problem

You have developed an ASP.Net Web Application and you've added a new .cs class (not a new ASP.Net Web Page) to your application, but when you try to test your app, you get the following error:

The type or namespace name 'xxxxxx' could not be found

Solution

The solution is simple and twofold:

  1. in Solution Explorer, move your .cs class file to your Web Application App_Code folder
  2. once done, right click your .cs class and in the Properties pane, change its Build Action property to: Compile