I am using Visual Web Developer Express 2010 edition. I have chosen "New Website" (and not New Project) to build a website. My project is targeted for .NET 2.0
I have a class file which I originally created under the App_Code
folder. I instantiated an object of the class in my default.aspx.cs
MyClass m = new MyClass();
This compiles fine. However, the moment I deploy it on my remote IIS Server, it gives a compilation error when I invoke the remote website from my browser.
error CS0246: The type or namespace name 'MyClass' could not be found (are you missing a using directive or an assembly reference?)
So I found this SO Question here - The type or namespace name 'LAD' could not be found (are you missing a using directive or an assembly reference?)
It says that I shouldn't put the class file into the App_Code directory. It asks to put it in a diff place and set the Build Action (in Properties) to Compile. I couldn't find a Build Action in Properties in "MS Visual Web Developer 2010" - so I had to skip that step.
So just I deleted it from App_Code and recreated it in the root folder. Now my project doesn't build at all - I get the same error on the build phase itself.
Error 3 The type or namespace name 'MyClass' could not be found (are you missing a using directive or an assembly reference?)
I have a strong feeling my MyClass.cs doesn't get built at all. What do I do? How do I tell the IDE to build it?
Follow this step:
Check now it works.