Multiple Programming Languages in App_Code Folder

Posted Monday, August 14, 2006 4:35 PM by C-Dog's .NET Tip of the Day

By now, you have probably used the App_Code folder. Today, I encountered a fairly common error that can occur when working with a project that has multiple programming languages (i.e.: C# and Marcus's favorite Visual Basic .NET). When you add a C# file to an App_Code folder containing VB files and compile you will get an error similar to the following.

'App_Code/file.cs' and 'App_Code/file2.vb' use a different language, which is not allowed since they need to be compiled together.

The reason you receive this error is that by default everything in the App_Code folder gets compiled down to a single DLL which means the langauges can not be different. This is easy enough to fix, simply create a new subfolder in the App_Code folder (i.e.: CS or VB), and then add the following elements to the compilation node of the web.config.

        <add directoryName="CSCode" />

Making this simple change will allow you to have seperate subdirectories for different programming languages.

Read the complete post at