Why C web Applications Can't Access Classes Under app_code and Solutions

  • 2021-12-09 09:43:06
  • OfStack

When developing web with C #, you can create website and application program in two ways. Application program uses more in this way. Under website, you can access classes under app_code, which is not supported by application program.

The workaround is to change the property generation operation of the class under app_code from "content" to "compile".

In this way, the class under app_code and the class under the normal folder are the same.

By the way, Baidu made the difference between content and compilation. Content (Content)-does not compile this file, but includes it in the "Content" (Content) output group. Compile (Compile)-Compile the file into the build output. This setting is used for code files. When an C # project is added to Solution Explorer, you need to set the file type to the compile type. cs files are code files that can be compiled.


Related articles: