Organizing Source-Controlled Solutions that Contain Web Projects
When we have a Solution with a number of projects in it - the best practices to organize it on he file system is like so:
- SolutionFolder
- sln file
- Project1Folder
- Project2Folder
- WebProject1Folder
- WebProject2Folder
- ...
- ProjectNFolder
When we have solution tree organized this way it is obvious that each web project folder should not be placed under default wwwroot$ folder (Like c:\inetpub\wwwroot\) since all other projects have to be on the same level hierarchy both physically and in Source Safe.
Here where the problems begin... Sometimes you may receive the following error when loading a solution in Visual Studio .NET that contains a web project. I have found that this error occurs when the solution was created on one machine and you are trying to set up the source code environment on another.
"Unable to read the project file '[ file name ]'. The system can not find the file specified."
Or alternatively your Visual studio will refuse to load web project when you open the solution. Like this:
"Unable to create Web project 'http://localhost/MyWebProject'. The file path 'D:\Projects\MySolution\MyWebProject' does not correspond to the URL http://localhost/MyWebProject. The two need to map to the same server location."
I can mention that this last error message can usually be plain wrong and I spent hours trying to solve this or create a workaround. Visual Studio 2003 will just refuse to load web project in the right location while setting development environment on another machine. Or alternatively it can download the project to wwwroot$ folder location.
Steps to resolve this issue:
- Virtual directory alias should be the same as the name of the web project folder due to the bug in Visual Studio (IIS supports different). It should be set this way on the machine the solution and web project were originally created.
- Every change like this requires deleting of VSWebCache in "Documents and Settings".
- The 1st time the entire solution is opened on another machine - it should be done from source control inside Visual Studio empty environment when folder (supposed for web project location) already exists and "web shared" beforehand (and it should be empty). When the entire solution is opened from Source Safe like this - the solution file is binded after all projects are downloaded and binded.
- Obviously Source Safe "Set Working Folder" should be preconfigured also.
Wednesday, May 10, 2006 3:00 AM