.Net Web Site to Web Application

At my current employer, I support and develop desktop and web site applications.  The biggest and most important application is a .Net WebForms website written in VB.net.  Though I have done VB and some VB.net in the past, most of my recent experience has been in C#.  For the previous 6+ years I had done mostly WPF development and some MVC, so my experience with ASP.Net WebForms was outdated to say the least.  So I quickly did some research and was pleased to learn that WebSite projects in VS support both VB.net and C# and can be mixed (contain both).  As I took over the development and support I began to add new pages with code behind in C#.  I also wrote new C# classes in the App_Code folder for shared business logic across pages.

But… what I really wanted to do was upgrade or migrate this WebSite project to a Web Application project and take advantage MVC and my experience in MVC and WebApi.  But I was quickly reminded that a .Net Web Application project only supports one language at a time, NOT mixed (per project, yes a shared library project can be in a different language).  But I have now mixed language web site project, but most was in VB and the bulk of the C# is in the App_Code folder which I could but different class library project.  But I learned that if you convert a .net web site project to .net web application, you can not later convert the language of the project.  So… If I wanted the new .Net Web Application to be in C#, I had to do the conversion in the Web Site before converting it to the Web Application project.

while-alive-if-calm-keep-calm-code-onI also learned that a .Net 4.5 Web Application can host MVC web pages, WebApi, WebForm pages… or all 3 within the same project.  THIS was GREAT!  WHY?  Because once I convert all the WebForm pages to C#, I can simply move the WebForm pages into the new Web Application project and then slowly page by page, functionality by functionality, etc… migrate or move to MVC web pages and take advantage of separation of concerns and more reusability.

Needless to say… I have a lot of work to do…

Ref:  http://www.cryer.co.uk/brian/mswinswdev/ms_dotnet_mix_csharp_and_vb.htm

Leave a Reply

Your email address will not be published. Required fields are marked *

This site uses Akismet to reduce spam. Learn how your comment data is processed.