For historical reasons I find myself developing some ASP.Net content in a mixed language environment. I have some older, legacy code written in C# that I need to integrate into a new web site written using VB.Net. Putting the VB.Net .ASPX pages into a separate directory from the C# .ASPX pages got around most of the problem, but I was left with some common code that belongs in the App_Code directory of both sites. .Net won’t let you compile mixed languages into a single assembly, and since everything the the App_Code directory needs to be compiled into a single assembly I was in a bit of a quandary about what to do.
Fortunately, it turns out there is a simple solution to the problem. You just need to put your C# code into a sub-directory of the App_Code directory and make an entry in the <compilation> section of the web.config file. Add the following XML:
<compilation ... > <codeSubDirectories> <add directoryName="App_Code_CS" /> </codeSubDirectories> ... </compilation>
Where App_Code_CS is the name of the sub-directory containing the C# code.