Visual Studio - Website Vs Web Project
-
21-09-2019 - |
Question
I previously have been involved in a lot of classic ASP based websites, so when it came to migrate to ASP.Net, I took the Website route as it is very similar. I am just about to start on a large new project and wondering if I should re-evaluate my processes.
I have been reading up the best part of a day on the differences between a web project and a website.
I do understand the differences, however they seem so similar. The biggest difference I could find is that, a project is pre compiled however someone else replied that a normal website can also be pre compiled as an option.
My question is really, going ahead, will Microsoft support both for the long term or is one "gaining" influence / becoming the normal?
I would have thought (although not certain) that the benefit of pre compiling in a project is for speed, but if I can also pre compile a website, does this negate any sort of benefit?
I will feel a lot more comfortable using what I have for years - but am I actually missing anything out? At the end of the day, when I have finished writing the site and hand over to the client, is there any benefit to one over the other?
I was also wondering, if I ever make the wrong choice, can you change between them?
Hopefully not a duplicate, The only other posts I found discuss the actual direct differences, I believe I know them and am asking for the difference post-project etc.
Solution
For me the biggest difference is the relationship between the pages. In a website project, each page is essentially it's only little project which is or can be compiled separately from the rest of the pages in the application. In a web application the entire project is essentially compiled into a single DLL. It's very much akin to a class library project.
As such I tend to prefer Web Applications. Simply because it reduces the amount of thinking I have to do when working with the project. For the majority of situations I can treat the project just like I would any other class library.
Some other differences I didn't see mentioned in your post
- You can do live edits of web sites project on a deployed server. Simply open up the file, make an edit and the next time the page is visited it will be re-compiled. Some people may consider this a bad thing
- A web site has no project file which can make persisting settings with a project challenging.