work with multiple languages in your /App_Code folder

Having two classes made up of different languages in the /App_Code folder (as shown here) causes
an error to be thrown. It is impossible for the assigned compiler to work with two different languages.
Therefore, in order to be able to work with multiple languages in your /App_Code folder, you must
make some changes to the folder structure and to the web.config file.
The first step is to add two new subfolders to the /App_Code folder—a /VB folder and a /CS folder.
This gives you the following folder structure:
/App_Code
/VB
Add.vb
/CS
Subtract.cs
This still won’t correctly compile these class files into separate assemblies, at least not until you make
some additions to the web.config file. Most likely, you don’t have a web.config file in your solution
at this moment, so add one through the Solution Explorer. After it is added, change the <compilation>
node so that it is structured as shown in Listing 3-17.
Listing 3-17: Structuring the web.config file so that classes in the /App_Code folder
can use different languages
<compilation>
<codeSubDirectories>
<add directoryName=”VB”></add>
<add directoryName=”CS”></add>
</codeSubDirectories>
</compilation>
Now that this is in place in your web.config file, you can work with each of the classes in your ASP.NET
pages. Also, any C# class placed in the CS folder is now automatically compiled just like any of the classes
placed in the VB folder. Because you can add these directories in the web.config file, you are not required
to name them VB and CS as we did; you can use whatever name tickles your fancy. 
评论
添加红包

请填写红包祝福语或标题

红包个数最小为10个

红包金额最低5元

当前余额3.43前往充值 >
需支付:10.00
成就一亿技术人!
领取后你会自动成为博主和红包主的粉丝 规则
hope_wisdom
发出的红包
实付
使用余额支付
点击重新获取
扫码支付
钱包余额 0

抵扣说明:

1.余额是钱包充值的虚拟货币,按照1:1的比例进行支付金额的抵扣。
2.余额无法直接购买下载,可以购买VIP、付费专栏及课程。

余额充值