App_code in ASP. NET Contains classes written in different languages

Source: Internet
Author: User

Classes placed in the app_code folder of ASP. NET programs can be automatically compiled into an assembly. all the classes and methods used in the Assembly on the page will be automatically called and updated, which is very easy to maintain. However, the classes in this folder can only be written in one language, Visual Basic. net, C #, J #, JScript .. net because it is compiled into the same assembly and processed by a compiler. To use different languages, you must use folders to group class files and add necessary configurations to the configuration file, the build system is required to create different assemblies-one assemblies for each language.
Assume there are two class files named code. CS and code. VB respectively. Because they are written in two languages, they cannot be put together in the app_code directory. Now create two folders to solve such conflicts :~ /App_code/CS and ~ /App_code/Vb, and put the two files in the corresponding folder respectively. Add the following configuration in Web. config:

<Configuration> <compilation> <codesubdirectories> <add directoryname = "CS"/> <add directoryname = "VB"/> <codesubdirectories/> <compilation/> </configuration>


Note: <codesubdirectories> must be placed under the <compilation> node.

Contact Us

The content source of this page is from Internet, which doesn't represent Alibaba Cloud's opinion; products and services mentioned on that page don't have any relationship with Alibaba Cloud. If the content of the page makes you feel confusing, please write us an email, we will handle the problem within 5 days after receiving your email.

If you find any instances of plagiarism from the community, please send an email to: info-contact@alibabacloud.com and provide relevant evidence. A staff member will contact you within 5 working days.

A Free Trial That Lets You Build Big!

Start building with 50+ products and up to 12 months usage for Elastic Compute Service

  • Sales Support

    1 on 1 presale consultation

  • After-Sales Support

    24/7 Technical Support 6 Free Tickets per Quarter Faster Response

  • Alibaba Cloud offers highly flexible support services tailored to meet your exact needs.