VB and C# in ASP.Net

G

Guest

I would like to put two sub folders in app_code;
one called VB and one called CSHARP.
Can I put some compile directive in Web.Config to invoke the vb compiler for
the app_code/VB directory and the C# compiler for the app_Code/CSHARP
directory?
 
G

Guest

I would like to put two sub folders in app_code;
one called VB and one called CSHARP.
Can I put some compile directive in Web.Config to invoke the vb compiler for
the app_code/VB directory and the C# compiler for the app_Code/CSHARP
directory?

To do this, you need to register each subdirectory in the Web.config
file for the application.

<configuration>
<system.web>
<compilation>
<codeSubDirectories>
<add directoryName="CSHARP"/>
<add directoryName="VB"/>
</codeSubDirectories>
</compilation>
</system.web>
</configuration>
 
J

Juan T. Llibre

you can add subdirectories to the App_Code directory
in order to process multiple languages under the App_Code directory.

In order to do this, you need to register each subdirectory in the application's Web.config.

<configuration>
<system.web>
<compilation>
<codeSubDirectories>
<add directoryName="VB"/>
<add directoryName="CSHARP"/>
</codeSubDirectories>
</compilation>
</system.web>
</configuration>

Then, simply creating the App_Code\VB and App_Code\CSHARP directories,
and placing your VB and CS files in each, will allow you to use both languages in your app.

This only works in ASP.NET 2.0! ( and is quite easy to implement )

Caveat: this works only for "helper classes".
You cannot place code-behind pages in the individual language directories.

However, it *does* allow you to mix different-language source files in the same app.

An alternative would be to compile your different-language source files
from the command-line, and placing the compiled assemblies in /bin.
 

Ask a Question

Want to reply to this thread or ask your own question?

You'll need to choose a username for the site, which only take a couple of moments. After that, you can post your question and our members will help you out.

Ask a Question

Members online

Forum statistics

Threads
473,770
Messages
2,569,583
Members
45,075
Latest member
MakersCBDBloodSupport

Latest Threads

Top