From: http://www.west-wind.com/WebLog/posts/13132.aspx
ASP. NET Projects to WAP conversion 6 commentsFebruary 26,200 7 @ pm-from Maui, Hawaii
Over the last few weeks I 've heard from a couple of friends who decided to update their ASP. NET 2.0 projects to Web Application Projects and ended up running into a number of problems in the process. the process of converting existing projects is probably not as straight forward as it cocould be and it involves a few manual steps of copying files and moving things around und in the projects which are not directly obvious.
Scott Guthrie has some excellent walk throughs that talk about the basics, but I suspect most people don't have such simplistic projects that they are dealing. most projects have rather large number of files scattered through varous directories that contain a variety of code and support files etc.
I hadn't tried a conversion recently after the new integration with Visual Studio 2005 SP1, so thought for kicks I 'd run through the exercise of converting this application that is of medium complexity and has several levels of inheritance in the page layout and see how it goes. when I tried this previous with early versions of WAP this participates application was rather problematic to port, althoug H others I ported over where somewhat easier. So here's take two <s>...
For reference the app has about 50 pages about 10 user controls, several Web Services, several themes and several master pages in a theming Master Page theming mechanic that matches the style Themes.
While there are a few issues to watch out for, overall the process went pretty smooth. it took about a half an hour to do the full conversion, so here's a quick review of what did and how I got around a few of the errors that popped up in getting the installation to run. the points here are mostly bullet points-if you want to look at a real step by step walk through use Scott's tutorials and come back here if you run into problems <s>.
Copy files into the new WAP Project from Explorer
The approach I took is like Scott suggests which is to create a new WAP project and then copy the existing ASPX and other files into the project. this is fairly straight forward-you can just drag and drop the source files from a directory into the new project. make sure you only copy files/directories that contain code related files-unlike stock projects WAP projects shoshould only contain compilable files and don't contain everything such as images/css etc. do copy all of your APP _ folders though as these are special folders including your APP_CODE folder which WAP will later rename.
Set References
Once you 've added the files to the project, go ahead and make sure you add all references you have defined in the references section. unlike stock projects, WAP uses real project references and doesn' t use values stored in web. config. if you're not sure what references you have defined look in your Web. config and match the settings from the <compilation> <assemblies> references. in addition, you'll also want to add explicit references to anything that lives in your BIN folder so that the compiler can find them. again, unlike stock projects WAP projects don't use the ASP. NET compiler but use standard compilation so anything that is compiled must be referenced by the project directly.
Convert to Web Application
At this point you can go ahead and actually convert your ASP. NET pages and controls etc. to the new WAP format by usingConvert to Web ApplicationOption. Right click on the project node in Solution Explorer and let 'er rip. This can take a bit on a large project. Note any errors that show up in the error window.
It's very likely that you will run into some issues at this point.
You may find that you see page conversion errors. This might especially be true with pages that have inherited based classes other than Page.
APP_CODE and the Compile Option
The first problem is one of the converter: Stock projects require that all Code for a Web Project is stored in the APP_CODE folder. WAP recognizes the special APP_CODE folder but requires that it is renamed and so it creates a OLD_APP_CODE folder. it creates the folder containing files marked with a Build Action-Content (select the source code file and look at properties ). the file shoshould be marked with Build Action-Compile. without this none of your APP_CODE related code will be recognized most likely causing big problems for compilation.
Namespace and Control References
Stock ASP. NET projects have a nifty feature that allows you to store attached ded namespaces and control references in web. config. when stored there these namespaces and control references are automatically inserted for you so you don't have to explicitly define them. WAP doesn't support this, so if you used this feature you will now get compilation errors. no big deal-you just have to add the control references explicitly to ASPX/ASCX etc. pages and add namespaces to codebehind pages.
Web. Config settings pointing at APP_CODE
If you have HTTP Handlers or Modules and you 've defined them in the application you may find that you 've explicitly pointed them at source code in your APP_CODE directory. For example:
<HttpHandlers>
<Add verb = "*" path = "*. wws"
Type = "Westwind. WebStore. PageRedirectorHTTPHandler, App_Code"/>
</HttpHandlers>
You need to now point this at the output assembly of your project:
<HttpHandlers>
<Add verb = "*" path = "*. wws"
Type = "Westwind. WebStore. PageRedirectorHTTPHandler, WestWindWebStore"/>
</HttpHandlers>
And at this point the app was up and running and working 100% under WAP.
Compilation is different with WAP!
When you switch to wap asp. NET is no longer compiling your application completely. only the CodeBehind of the actual pages in the project are compiled by the compiler in. NET-the ASPX pages are handled at runtime by the ASP. NET compiler. this means when you compile a WAP project you get no warnings/errors reported in your ASPX/ASCX/MASTER page markup code for expressions or embedded code. only CodeBehind compiles.
If you still want full compilation of your project-perhaps optionally-you can still use Web Deployment Projects. there's been some confusion about WDP in that it is not part of Visual Studio 2005 SP1. WDP continues to be a separate download.
I'm still hopeful that Microsoft at one point will provide direct single assembly compilation as part of the ASP. NET compiler and provide an option to run that from a WAP project to 'double check' a complete application compile. we'll see.
This is by no means an exhaustive review of issues, but these are some of the things I 've run into in several conversions.