Best Practices for Setting up Source-Controlled Solutions that Contain Web Projects

A customer recently hit me with the following question:

“When we set up our web projects, we mirror our file system view to our repository view using a virtual directory. Ex. file system - c:\Webproj_soln (this is our solution, under that would be our project c:\Webproj_soln\Webproj. This is where we would create our virtual directory, so it directly mirrors our repository. Is this still a best practice? I know some people just take the defaults and put everything under inetpub.”

My Response:

You're doing it exactly right. Brief historical detour: in the first version of Visual Studio .NET, there was a bug that effectively prevented placement of source-controlled Web projects outside inetpub. I can't remember the details off the top of my head but I do know that the issue was resolved in a pre-Visual Studio .NET 2003 update. It's entirely possible that the folks who keep their Web projects in inetpub were conditioned to do so by this early bug.

Best practice? If you don't use source control, inetpub/wwwroot is fine. From a source control perspective however, it's really wise to organize your local copy of a solution in exactly the same way as the server version is organized in the repository. It therefore makes sense to save your solution to a non-inetpub directory and when enlisting in or adding a Web project to the solution, to create a virtual directory. I went into the reasons why this is a good idea in a blog post I wrote last year, Guidance on Creating Projects and Solutions.

For more details and best practices, see the Team Development Guide's Structuring Solutions and Projects chapter and Web Projects and Source Control Integration in Visual Studio .NET.”

Comments (15)

  1. Simon T says:

    I have the same problem, in 1.1 we get the nice spangly solution.root option in Vss to place projects in but according to the docs I read unless your web projects are created in wwwroot$ then it will not auto create them.

    Whilst I can pre-create the Virtual directory and point it at the corect directory mirroing the SS layout, why should I ? Your constantly fighting the default behaviour and there are no options, I am aware of, to alter this behaviour. This also causes problems when opening from the filesystem intead of Source code control as many a time it refuses to use My Virtual directory and tries to create another _1 version.

    So am I missing something ? Is there an option to get VS.NET to create the project where I want instead of wwwroot$ or like I mentioned I have to predetermine the VD location ?

  2. Darrell says:

    Simon, no there is no way. The best solution we came up with was to write a batch file that created the appropriate folders and virtual directories under a solution folder that you specify. It also downloaded the solution file. You ran the batch file. Then you double-clicked on the solution file and it downloaded the rest of the solution.

    A definite kludge, and one reason why Fritz Onion and others liked to use class libraries instead of ASP.NET projects. In the Whidbey version, I believe you will be able to run an ASP.NET project without IIS installed at all, so you will no longer need to create virtual directories.

  3. chris says:

    SourceSafe seems to be stuck in a rut. Is it being developed further or has it reached a point of maturity where no further development is necessary?

    A nicer interface would be…nice.

  4. Persone los pioneros non rabata. Great…

  5. lesbian rape says:

    Best of all people w can talk…

  6. rape videos says:

    Your article is quite right, thanks.

  7. Thanks for the great tips about <a href=""”>" title="house insurance">house insurance</a> and [URL=]house insurance[/URL]

Skip to main content