Re: Visual Studio "New Project" or "New Website"



John,

I appreciate that input, since I'm pretty much a newbie at this. But
I have a couple questions:

1) Why do you say that a "WebSite" is not suitable if you have
significant server-side code? What can you do with a Web-Application
that you can't do with a WebSite (providing you use "Publish WebSite,
which actually generates the DLL - I agree, I don't want my C# code
out there on the site being built at execution time.)? Please
understand, that is a serious information-seeking question, not an
argumentative one.

Let me answer this question with a question. Do you have a background in software engineering? Are you familiar with the Software Development Life Cycle (SDLC)? Unit testing, QA testing, nightly builds, source control? These are all things that are available to all other kinds of application. They're not available for web sites, because they're not applications.

For instance, you correctly raise the fact that the Publish command can cause your code to be compiled first, and can even compile or partially compile your pages. That's great, but what next? Do you publish to your live site, or should your QA organization test it first, possibly on several different machines at the same time? In that case, which code are they testing? Did you publish it once, then copy to the different QA machines, or do you (manually) publish to each QA system, recompiling the code each time (producing slightly different code each time you publish)?

Another thing is automated unit tests, or anything else that requires the code to be compiled first.

I guess my overall thought is that this "Web Site" paradigm started off being for developers of their company web site, then anything else was added on top of that to handle situations that weren't that simple. But we already had a paradigm that worked for all other kinds of application, and was working well for web applications before VS2005, and works well for web applications since VS2005 SP1. What was the point of the change? It didn't solve any problems I had, and I had been developing ASP.NET Web Applications since 2002. This led me to conclude that the problems solved by Web Sites must have been problems I had not encountered since 2002 - the solutions must have been for people doing a different kind of development. Since I've always built applications, this must have been for people who were not creating applications.

I think they named the paradigm for the problems they intended it to solve. It's for web sites, not for web applications. It may work for your web application, but you'll eventually hit issues where the answer is, "but if you knew you were creating an application, then why did you start by creating a web site?"

2) What about all the features/tools that just don't seem to work for
Web Applications? I had a dickens of a time trying to get things to
build when I was doing it as a Web Application, to the point that I
scrapped the whole project and started it over as a WebSite. Is there
a way around it to make those features work right?

I don't know what features or tools you're referring to. Any such tools would have been those that were introduced with Visual Studio 2005. Since web applications were created quite successfully before VS2005, at the very least you have workarounds available - just do what we were doing before VS2005.

However, I have found several cases where the tool that didn't work was a "Web Site" tool. The confusion was that when VS2005 came out, the intention was for web sites to replace web applications. This implies that the web site documentation replaced the web application documentation. This has not entirely been corrected, as the materials for new developers talk about web sites. You may have learned to do use a web site tool that does not work on web applications, and may now be unaware of how to do the same thing with web applications.

If Microsoft had originally intended to have web sites and web applications coexist, this would not have been a problem. They would have had the same set of commands work with both. Instead, they get a mess.

--
John Saunders | MVP - Connected System Developer

.