C# – asp.net web application with c# & vb.net both in codebehind

asp.netcprojects-and-solutionsvb.netweb-applications

We currently have a asp.net website with some modules developed in VB.Net & some in C# (not just classes but also individual aspx pages and code behind). We figured we wanted to move to web application model as we need to implement CI with TFS.

The problem :

When we create a C# web application, copy the files from website & say convert to web application it gives Could not Parse errors (probably because files are vb.net files)

When we create a VB.NET web application, copy the files & say convert to web application it converts only vb.net pages & on publishing throws error on all c# pages saying Could not load type

The asp.net website would work properly with multiple codebehind language support.

Help would be highly appreciated!

Best Answer

Can you break the app into 2 separate web applications that run from the same root directory? Just put the complied C# dll in the bin with the compiled VB.net dll and place all of the aspx pages wherever they would need to be for your site structure.

I haven't tried this myself, but it should work. You'll have to create a separate project and reference any data layers, etc. Just move the C# code to the new app and see how that goes. Not the best solution, but it beats converting from one language to another.

Related Topic