Wednesday, May 4, 2011

Using C# and VB.net togheter in Asp.net

To use in the same Asp.net Web Application classes written in different languages, such C# and VB.net, you have to do this steps:

Create in the App_Code folder two subfolder, called for example VB and CS:

App_Code
->VB
->CS

Next, add in the web.config this lines:
<system.web>
[...]
<compilation>
<codeSubDirectories>
<
add directoryName="CS"/>
<add directoryName="VB"/>
codeSubDirectories>
[...]
compilation>
system.web>

And voila, its done!

PS: obviously, you have to put all vb.net classes in a folder and all the c# classes in the other folder...