This has by far been the most popular q on our forums despite some really good documentation around this. First, a look at why this is a troublesome issue. Then, a step by step process to solve your build issues (that was easy, considering all I had to do was point to blogs someone else had already written 🙂
Web projects differ from normal managed projects in that they do not have a project file. We all know that, don't we. But it does have a solution file and a folder to save the web pages and code in. The problem comes from source control where web projects are checked in a bit differently from other projects. It is usually checked in as
inspite of the solution file perhaps being in the D:\Documents and Settings\User\BlahBlah... folder that might be several steps nested deep within compared to the web project contents folder that might just be in D:\Temp. Source control maps the contents as described above but does not edit the .sln file which still points to the web folder as ..\..\..\...\WebProject based on the level of nesting. More details on this later. Yet another difference arises from the platforms that web projects are built in. Before Whidbey RTM, you would have noticed that web projects did build with "Any CPU" platform. But since RTM, any solution that contains only web projects will build with only ".NET" platform by default and a solution that contains web projects as well as class libraries will have to be built in the platform "Mixed Platforms". Both platforms are available as drop down options in the build configuration wizard in the Configurations page.
Now, the step by step process to build web projects. Nagaraj has a very detailed blog entry on how to build web projects from scratch here. I have also posted a tech note on building web projects here. After making the right entries in the web projects, please do not forget to choose "Mixed Platforms" in the Configurations page to build solutions that have other managed projects also along with the web projects and ".NET" to build pure web solutions. Another interesting option to explore would be the web deployment project add in that creates a kind of actual project file per web project. You can find a tech note on that here and a relevant blog entry here.