asp.netapp-code

App_Code folder not recognized in "WebSite" project


I built a Web Site project (not Web Application) in Visual Studio 2017. I have a couple of generic classes in App_Code folder which are required in many Code Behind pages. It works perfectly in my local environment. But, when I upload them to the server, I get following compilation error.

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

I created the App_Code folder by right clicking on the project; and even those classes were created there (not copied from anywhere outside).

Now, when I look at the solutions here, people are often mistaken Web Site with Web Application. In Website you cannot change the "build" to Compile; you don't even see the "build" option under class properties menu. OR my Visual Studio hiding that option from me?

Can anyone help me out please?


Solution

  • How are you uploading to server? Simply XCopy or Publish? Try publishing. It should solve the issue.