Convert your Website to Web Application
Website to Web Application
Follow the steps
- Add a new “Web Application” to your VS 2008 solution (File->Add->New Project->C#->Web->ASP.NET Web Application).
- Copy all the files in the old “website” to your newly created “web application”, and override any files created in it by default
- The next step is to “manually” add the references in your “website” to the new “web application
- Repeat the last step and trying to build the “web application”. You’ll keep getting errors like ” ‘….’ is unknown namespace. Are you missing an assembly reference? “. Make sure you have none of those except the ones where ‘….’ is replaced by the IDs of the server controls you use. In other words, keep adding references and building the project until only the errors that exist because of missing .DESIGNER.CS or .DESIGNER.VB files.
- Afterwards, go to the “web application” root project node in VS 2008 solution explorer, and right click it, then you WILL find the option “Convert to web application”. What this option does is actually making small changes to the“@Page” and “@Control” directives of pages and controls, and creating the required .DESIGNER.CS or .DESIGNER.VB files.
- Building the “web application” again. If you get errors, see what references may be missing and/or go click the “Convert to web application” again. Sometimes, if there’s any error other than those caused of missing DESIGNER files, not all the pages/controls will have those DESIGNER files created for them. Fixing the non DESIGNER problem and clicking “Convert to web application” again should do the job for this.
- Once you are done successful VS build, you should be ready to go. Start testing your web application. Optionally, you can right click the “web application” root project node in VS 2008 Solution Explorer and click “Properties” then go to the tab “Web” to set the “web application” to a virtual folder in IIS (you can create new virtual directory from there in VS). If you want to use the IIS virtual directory that the old “website” used, you need to remove that from IIS first.
0 comments