Convert ASP.NET Website to ASP.NET Web Application

Written by rsolberg on. Posted in Software Development, Technology

HatM /Free Photos
It wasn’t that many years ago that it seemed like I’d create a new ASP.NET website a few times a week.  Some for rapid prototyping and others for release.  At the time, the applications felt really easy to manage.  That is until they grew and became a beast with all kinds of integration needs. As soon as you start needing to integrate with other systems, databases, applications, etc. the ability to use namespaces and existing components becomes a requirement.  Without it, your code would become completley unmanageable with a complete lack of reuse of components and functions.  I’m not saying that you can’t maintain some good coding practices within an ASP.NET website, but when the app grows and its being integrated with, I absolutely hate code sprawl.   My philosphy on coding is rather simple:  Code it once so that you can reuse it at least twice. Obviously not every code block you write will be reused, but say you have a function to get a contact’s name from your CRM system…  It would seem like this is something you’ll do over and over and over again, so code it once, use it at least twice… With all that said, the need arose to be able to convert these growing ASP.NET websites into ASP.NET Web Applications.  When I got to that point, I was able to find a great resource by Mohamed Meligy on this very topic. Essentially it comes down to a few steps…
  1. Create a new blank solution within Visual Studio
  2. Add a new Web Application Project to the newly created solution
  3. Import existing website files into newly created Web Application project (overwrite files as needed)
  4. Manually add references into the new project that you had in your old website
  5. Once all refernces are added, you likely have many namespace errors.  Create the new namespaces as required.
  6. Now we need to perform a conversion process on the web application project, right click on the new Web Application Project and select “Convert To Web Application”.  This should fix missinging designer.cs or designer.vb.
The above steps will still keep all of your code within a single project in Visual Studio.  Depending on what the application is, does, etc. you may be better off adding a few different projects to seperate database connectivity, data models, and classes that interact with the DB.
Be Sociable, Share!

Tags: , , , , , ,

Trackback from your site.

Leave a comment

© Copyright RSolberg, 2003 - 2014. All Rights Reserved