Logo Questions Linux Laravel Mysql Ubuntu Git Menu
 

Is it possible to have C# and vb.net in the same asp.net website?

Is it possible to have C# and vb.net in the same asp.net website? without separating in class libraries.

like image 577
Bassel Alkhateeb Avatar asked Dec 30 '22 07:12

Bassel Alkhateeb


2 Answers

Try this in the App_Code subfolder create 2 new subfolders, one for your C# classes and another for your VB.NET classes. After that specify these 2 folders in the web.config in the section like this:

<system.web>

<compilation debug="true">

<codeSubDirectories>

<add directoryName="CSharp"/>

<add directoryName="VB"/>

</codeSubDirectories>

</compilation>

Or you can create new project in other language and add referenc to it.

like image 189
Florim Maxhuni Avatar answered Dec 31 '22 21:12

Florim Maxhuni


No - the compiler needs code files in different languages to be compiled separately. A C# class library cannot contain VB.NET code, simply because the compiler can't distinguish which code files are written in which language.

like image 33
Tomas Aschan Avatar answered Dec 31 '22 21:12

Tomas Aschan