|
|||||||||||||||||||||||
|
|||||||||||||||||||||||
|
Announcements
Chapters
Services
Feature Zones
|
Note: This is an unedited contribution. If this article is inappropriate,
needs attention or copies someone else's work without reference then please
Report This Article
Introduction and problem statementEarlier I created our website using VS2005. As you are aware that VS2005 handled website solutions a bit differently, since it doesn’t have project files for websites. Everything that is in the folder is included in the build/site, unless otherwise excluded. ReferencesThe Web Application feature is now back in VS2008. This article will help you upgrading your website projects created in VS2005 to the web application projects in VS2008. You might need this in order to get full benefit of the new features of VS2008 or you might be upgrading your site to the later versions of .Net (3.0 or higher). You can have a look upon the following articles that detail about the enhancements in VS2008: http://msdn.microsoft.com/en-us/library/bb386063.aspx http://weblogs.asp.net/scottgu/archive/2007/11/19/visual-studio-2008-and-net-3-5-released.aspx SolutionI was searching upon some quick reference upon upgrading things and this article is for those who want steps to upgrading quickly. ScopeAs the title suggests, we are upgrading our website developed using VS2005 over .Net 2.0 and will be upgraded to VS2008 while keeping the .Net version. Before you beginMake sure you have the latest code in hand and compiled without errors. Preferably make a new folder and copy the code the new location. MigrationStep 1: Upgrading website to VS2008
Step 2: Changing website project to web applicationThe easiest way to migrate is to create a new solution/project and copy the site to it or add a new web application project to the one we created in previous steps:
However, if you want to add a VS2008 Web Application Project to an existing solution right click on the solution node and select Add->New Project. After the creation of VS2008 Web Application Project, remove the "default.aspx" and "web.config" files by deleting them; these files are added by the wizard by default. This is because; you’ll be using your own files. If you’ve created a new project, open the website in the same solution: FileàAddàExisting Website Moving the filesNow with both the web application and the website open in the Visual Studio, select all the files and folders in the website and drag and drop them to the web application. If the Data Source Configuration Wizard is launched during the process, cancel the dialog and allow the rest of the files to be dropped. Now Add references to your newly created web application, and remove the website from the solution.
Idea behind ConversionThe main difference in website projects and web applications is that Website Projects dynamically generate the tool-generated partial classes half of a page, and do not persist them on disk. The Web Applications on the other-hand do save these partial classes on disk within files that have a .designer.cs extension and compile them using the in-memory VS compilers when a build occurs. The conversionNow right click on the Node in the solution explorer and select Convert to Web Application.
You’ll notice the change in the Solution Explorer:
The designer.cs files are added to the pages. Where is my App_Code Folder?ASP.NET 2.0 dynamically compiles classes under the App_Code folder. Keeping your classes under this folder will get the classes compiled twice; resulting in "could not load type" runtime exception -- caused because the type names are duplicated in the application. I recommend using Classes folder to store your classes; however the "Convert to Web Application" command would rename the folder to Old_App_Code. Compile and RunYou’re almost finished, just compile and run the site to make sure that you’ve successfully migrated you website project to the web application project.
|
||||||||||||||||||||||