Technique for creating Web sites in Visual Studio

Onion Blog

Syndication

Lately I find myself using both Web Application Projects and Web sites, depending on the project. I like the immediacy and simplicity of the Web site model, but I also find that having a real project file useful on occasions as well and end up using WAP for those situations (and definitely prefer WAP for migrating 2003 projects).
I really like the way WAP puts everything into a single directory, including the solution and project files - it's a huge improvement over how it used to work in 2003 (see my work-around to the issues in 2003), not to mention the lack of dependency on IIS configuration.
Web sites are equally good in this respect, with one exception. When you create a new Web site, Visual Studio automatically creates and saves a solution file in your documents directory, which is of course never where I create my sites. So I use the following work-around when creating Web sites to get the same 'one directory' experience that WAP delivers:
  1. Create a new blank solution in Visual Studio in the directory of your choosing.
  2. Right click on the new solution in the Solution Explorer, and select 'Add | Existing Web Site…' and when presented with the file dialog, choose the same directory you chose for the initial solution (you can’t choose 'New Web site…' because it will complain that the directory is already populated).
  3. Voilà – a Web site with an accompanying solution file all in one self-contained directory!



Posted Jan 03 2007, 09:40 AM by fritz-onion
Filed under:

Comments

dominick wrote re: Technique for creating Web sites in Visual Studio
on 01-03-2007 8:30 AM
Hi Fritz,

for step #1, this is very handy:

http://www.peterprovost.org/archive/2005/10/25/8982.aspx
Beverley Herbert wrote re: Technique for creating Web sites in Visual Studio
on 01-09-2007 7:44 AM
Mr. Onion,

I utterly ignore what / where VS stores its working solution - let it keep track how it wants. I never look at the sln/suo files in the Projects folder of Visual Studio 2005 in the My Documents area. I don't use My Documents for anything.

I simply go to File > Create New Website
or File > Open Website
and create or point to the project folder I want to work on on my Projects harddrive (D:\). I publish to a different folder on my Applications harddrive (C:\) and instantiate as a virtual site using IIS.

herbertb@tag.scmd.state.sc.us
Christopher Steen wrote Link Listing - January 14, 2007
on 01-14-2007 9:45 PM
Examining ASP.NET 2.0's Membership, Roles, and Profile - Part 8 [Via: ] A Look at ASP.NET 2.0's URL...
Jerry Ely wrote re: Technique for creating Web sites in Visual Studio
on 01-28-2007 10:03 AM
Hello,
If your objective is to just get the solution file in the same directory with the rest of the project, you can simply create an asp website project (1.1) then select the solution in solution explorer, go to file menu and do a Save As to save .sln file to the directory you want. I may be missing something? Of course this does leave purging the directory in the user files area.

regards
Jerry
peter gabris wrote re: Technique for creating Web sites in Visual Studio
on 03-09-2007 12:09 PM
This works for me.

I hesitate to have too many things in the My Documents since I found that windows tend to preload things from there. Do they still do that? All the polution pushed there when you don't watch?

Thanks for the tip.

Add a Comment

(required)  
(optional)
(required)  
Remember Me?