Convert .NET Web Site to Web Application
.NET Web Applications have several benefits over .NET Web Sites:
- Publish takes much less time
- Compile/Build is SIGNIFICANTLY faster
- More control over project properties, reference, publish/build settings, etc.
- Include/Exclude files in project versus auto-include
- MSFT new features and support will be targeted at applications ever increasingly as time goes on (phasing out web sites)
Example large web site with hundreds of pages:
-Publish took about 5 minutes.
-Build took about 2 minutes.
Converted to Web Application...
-Publish took about 15 seconds.
-Build took about 15 seconds.
Moral of the story: I should have done this a long time ago!!!
So, how do you convert a .NET Website to a Web Application (in visual studio 2010):
With the following cautions below, follow the walkthrough at http://msdn.microsoft.com/en-us/library/aa983476(v=vs.100).aspx
Note: Make SURE all of your custom/third party dlls including project references are added to the new web application BEFORE you click 'Convert to Web Application'. Otherwise, it completes "successfully" but doesn't compile, even if you add the dlls after. You will have to delete all the auto-generated files and reconvert if you do this in the wrong order.
Note: After copying files from the old folder to the new folder, mark them as editable or TFS will complain. (file system uncheck read-only)
Note: Certain Microsoft DLLs which were referenced in web.config in the web site now must be added as a project reference:
You can take them out of web.config.
If you're not sure which Microsoft DLLs are missing, you can wait until you build the final site to do this; the pages that have reference errors will come up as errors.
Note: When including files in the new project, don't include the obj folder, auto-genereated bin dlls (such as project references), or TFS/VSS source control config files.
Tested this on 2 web sites, and it seems to have worked.
Created By: amos 7/15/2013 12:11:56 PM
Updated: 6/30/2023 1:13:59 PM