Differences between Web Site Projects (WSP) and Web Application Projects (WAP) are highlighted in blogs such as this one. Based on that, if you feel a WAP would be better for your particular needs than a WSP, but have already created a WSP, you may be asking yourself, “Can I convert my WSP into a WAP, without starting from scratch?”.
This posting explains how to convert an existing Web Site Project to a Web Application Project in Visual Studio 2010. The most striking differences to a Web Site Project are that WAPs have a project file to include and exclude files, and compile to a single assembly.
The guidelines below include several of the basic steps detailed in the Walkthrough: Converting a Web Site Project to a Web Application Project in Visual Studio. This is an excellent topic to review as it discusses some specific issues you may encounter which were discovered in previous versions of Visual Studio (VS). Please keep in mind while reading it that it is based on a WSP to WAP conversion using previous versions of Visual Studio.
Let’s get started.
Open and Verify your Visual Studio Web Site Project Before converting your WSP to a WAP, you should open it in Visual Studio and verify that is it working correctly. This will help prevent the need to research errors that have nothing to do with the conversion process.
Create a new, empty Visual Studio WAP A good strategy for converting a WSP to a WAP is to create a new, blank Visual Studio Web Application Project in a separate directory, but in the same solution. This avoids changing any part of the existing Web site files. It also allows you to copy existing functionality and files into the new WAP easily, within the same Visual Studio instance.
Set Project / Assembly References If the WSP required additional project or assembly references, you need to add them to the WAP. You can see the list of default references associated with the new (empty) Visual Studio Web Application Project under the References node in Solution Explorer.
Copy and Convert the App_Code folder from the Web Site Project to the Web Application Project In WSPs, the files in the App_Code folder are all compiled together and then referenced (automatically) as a “dll” by all other files in the WSP. In WAPs, this is not the case. All code is compiled together as one .dll. I’ve found that copying the App_Code folder over first and converting it to the WAP model helps to head off some dependency issues which could arise if one copied the entire site, converted, and then tried to compile.
Copy and Convert the remaining Files and Folders from the WSP to the WAP Once your Old_App_Code folder is compiled (by compiling your WAP in the step above), your WAP will have an assembly in the \bin directory. This will make it easier for the remaining files you are copying over to successfully compile, especially if they reference or use code in the files contained within that folder.
Compile your WAP After all the files have been added and converted, you should build your project again to see if there are any compilation errors. At this point, some of the most likely causes of errors are:
Run your WAP After completing the above steps and you have a WAP which successfully compiles, you are ready to try running your application. One of the most common problems I’ve seen encountered is the “Unknown server tag ‘SomeTag: Control’ (as it applies to user controls and such)”. This can be corrected in one of two ways.
Hope this helps!
Nichole Baker SDET, Visual Studio Web Tools
Thanks, This might be helpful. But how to convert WAP back to WSP? Designer likes WSP more
Finally came across something i was looking for a long time. Although i was expecting more scenario's in terms of using WAP vs WSP and vice versa.
Thanks.
Hi BusTicket,
The scenarios for using WAP vs WS are highlighted in the post http://vishaljoshi.blogspot.com/2009/08/web-application-project-vs-web-site.html
Is there anything additional you were looking for...
Thanks
Vishal
I wrote about one of the pitfalls of using a ASP.NET Profile when converting app_code to a web project.
http://www.dalsoft.co.uk/blog/index.php/2009/09/12/converting-a-asp-net-web-site-to-a-web-application-project/
Helpful posts!
Thank you so much
This was the most useful writing on this topic, it covered all the topics especially the class name collisions, which I did not find in anyother article and that was the problem I was having! Thanks.