NOTE: This post applies to TFS 2005 and WDP 2005 only. For TFS 2008 and WDP 2008 the below does not apply. It’s much, much easier to work with Web Deployment Projects in Team Build in 2008 – you can read about it in my updated post.
Right, so yesterday I figured out how to make ASP.Net 2.0/3.5 Website projects work in a Team Build environment using Web Deployment Projects. Today I figured out how to get Web Application Projects to work.
The problem is explained in this thread – take a look at maharik’s post and BradleyB’s reply. maharik was having the same problem I was having, where the Web Deployment project was trying to build the wrong path. At this stage I still don’t fully understand what’s going on (why does the web deployment project need to be pointed to the compiled website?) but I know that it works.
So as background, I’m talking about a .Net 2.0 solution containing a Web Application Project, a Web Deployment Project and zero or more class libraries. The solution is part of a Team Project and I want to set up a Team Build to build the solution.
The Team Build must be set up using the Mixed Platforms as the platform (contrary to what the article I linked to yesterday said – but that article is still correct as far as Website projects are concerned). Choose a configuration (Release/Debug) and make sure your Web Deployment project is configured to build under the same configuration.
Try running the Team Build now. Everything but the WDP should build fine, and you should get errors like this:
error ASPPARSE: Could not load type 'masterpages_default'.
Now you need to follow the directions posted by BradleyB. Find the <SourceWebPhysicalPath>…</SourceWebPhysicalPath> element in your Web Deployment Project file. Comment it out and replace it with:
<SourceWebPhysicalPath Condition=”‘$(OutDir)’ != ‘$(OutputPath)’”>$(OutDir)_PublishedWebsites\WebApplication1</SourceWebPhysicalPath>
<SourceWebPhysicalPath Condition=”‘$(OutDir)’ == ‘$(OutputPath)’”>..\WebApplication1</SourceWebPhysicalPath>
Where ‘WebApplication1′ is the name of your website. Now check in the WDP file.
Now when you run the Team Build again you should find that everything runs successfully, and in your release folder there’ll be a deployment folder with the same name as your Web Deployment Project. Great! Now you can follow the last step from yesterday’s post to add the AfterCompile step to copy the website to your deployment folder.
Nice!