Your official information source from the .NET Web Development and Tools group at Microsoft.
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.
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...
I wrote about one of the pitfalls of using a ASP.NET Profile when converting app_code to a web project.
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.
Old post but helped me converting a website to a web application using Visual Studio 2013 Ultimate. Worked like a charm. Thanks!
Thanks, very helpful.
If you are using the ASP.NET membership and profile system, you also might have to make a custum profile like described by Jon Galloway here:
This was a very helpful start. I thought I would share some of my additional experience for others.
I was converting a site that was a mish-mash of C# and VB.net. My first step was actually to take all of the App Code files and create a C# DLL and a VB DLL. This could be troublesome and require some re-writing if there are circular references, I got lucky and the C# code was the new direction so it depended on the VB, but VB didn't have any dependencies on C#. Then I had to pick one language for all of the Code behind pages: I chose C# but that doesn't matter much. Also remember to set the Property on each page to Compile, don't use Content anymore. The biggest thing that continues to be a problem is not all of the Compile Errors are being displayed (VS2010 if that matters). The work around is to use the Output View and start at the first error message. The "Errors" tab is only the last 15 errors, when there are really 100's. Thanks again for a great start!
Thanks! Very helpful explanation!
Thank you so much