0

When I test my web site (asp.net c# .net4) on the localhost, everything works fine. However, when I publish it to my webserver, I get the error:

 Compilation Error
Description: An error occurred during the compilation of a resource required to service this request. Please review the following specific error details and modify your source code appropriately.

Compiler Error Message: CS0246: The type or namespace name 'MyWhateverNamedHere' could not be found (are you missing a using directive or an assembly reference?)

My code file (MyWhateverNamedHere.cs) lives in my App_Code folder, which IS moved to the webserver.

I have read where people move codefiles out of the App_Code folder. Didn't work for me. I tried giving them namespaces, and static references and just about everything I can think of. Then I found a solution that said Build Phases > Compile. But that's not an option for "web sites".

enter image description here

Any help?

user-44651
  • 3,924
  • 6
  • 41
  • 87
  • Microsoft has deprecated Web Site Project almost a decade. Could you not able to convert it to Web Application Project? – Win Feb 18 '15 at 19:59
  • Then why is it the second option in creating a new project in VS2013? – user-44651 Feb 18 '15 at 20:02
  • That is a good question. I guess it is a backward compatibility reason. Is there a reason not to use Web Application Project, because Web Application Project is [recommended for new projects](https://msdn.microsoft.com/en-us/library/dd547590%28v=vs.110%29.aspx)? – Win Feb 18 '15 at 20:17
  • I tried starting a new WAP and added the my codefiles to the project, gave them namespaces, the project could never see it. – user-44651 Feb 18 '15 at 20:21
  • This time you can change [build action to complie](http://stackoverflow.com/questions/14204990/unable-to-call-app-code-class-from-a-code-behind/14206137#14206137). – Win Feb 18 '15 at 20:29

0 Answers0