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.”