17

I've created a new class in App_Code

namespace Site {
    public class MyClass {
        public MyClass() {
        }
    }
}

this is my Global.asax.cs

namespace Site {
    public class Global : System.Web.HttpApplication {
        protected void Application_Start(object sender, EventArgs e) {
            *MyClass myClass = new MyClass();*
        }
    }
}

The error is in: MyClass myClass = new MyClass();

The type or namespace name 'MyClass' could not be found (are you missing a using directive or an assembly reference?)

What am I missing here?

acermate433s
  • 2,514
  • 4
  • 24
  • 32
  • I have other classes inside App_Code. I've tried pasting MyClass into one of those class and Global.asax.cs can find MyClass. Weird. – acermate433s Nov 18 '10 at 23:00

1 Answers1

28

Finally found out what went wrong. I've set the Build Action of the cs file to Content instead of Compile

acermate433s
  • 2,514
  • 4
  • 24
  • 32