Team Build 2008 and Visual Studio 2008 Web Deployment Projects
I wrote a post earlier this year about how difficult it was to get VS 2005 Web Deployment Projects and Team Build 2005 to play nicely together. Well in the 2008 versions it looks like they put some effort into removing a lot of the friction, so I want to explain how it works now and shout out that it’s much, much better than it used to be.
For the purposes of this example I created a simple website project, a web deployment project, and a basic build definition. There is a lot of information about how to create a team build definition in TFS 2008 so I’ll just gloss over that. The important points here are: a) the inputs (a website and a web deployment project) and b) the outputs.
The Build
Next I ran a build, and here’s what came out:
Notice that within the _PublishedWebsites folder are two folders: ‘Website’ and ‘Website_deploy’. In this example they are identical; if I had set up custom web config replacements then in the ‘Website_deploy’ folder would be a customised web.config file.
If I hadn’t created a web deployment project, the Team Build would still create the ‘Website’ folder and deploy a compiled website. This is important because I believe that didn’t happen with Team Build 2005, it just dumped the compiled assemblies into the Release folder. (Please correct me if I’m wrong).
Deploying where you want
The next thing you (probably) want is to have the deployable website copied from the timestamped drop location to a static location for an IIS website. Here’s how to modify your build script to do this:
1. In the solution explorer, right-click on the build definition and select View Configuration Folder.
2. The files will not be downloaded to your machine yet – highlight them, right-click and select Get Latest Version. Now double-click the TFSBuild.proj file to open the build script.
3. Now paste the following into the script, just before the closing </Project> tag:
<PropertyGroup>
<WebBinariesLocation>$(BinariesRoot)Mixed PlatformsRelease_PublishedWebSites</WebBinariesLocation>
</PropertyGroup>
<Target Name=“AfterCompile“>
<Message Text=“Copying from out $(WebBinariesLocation) to $(DropLocation)“/>
<RemoveDir Directories=“$(DropLocation)“ Condition=“Exists(‘$(DropLocation)’)“/>
<ItemGroup>
<ProjectSourceFiles Include=“$(WebBinariesLocation)***.*“/>
</ItemGroup>
<Copy
SourceFiles=“@(ProjectSourceFiles)”
DestinationFiles=“@(ProjectSourceFiles->’$(DropLocation)%(RecursiveDir)%(Filename)%(Extension)’)“>
<Output
TaskParameter=“CopiedFiles”
ItemName=“SuccessfullyCopiedFiles“/>
</Copy>
</Target>
What this will do is copy each of the deployment folders in the _PublishedWebsites folder directly into the drop location you specified in step 6 of creating the build definition (above). You don’t need to add anything specific to do with the project (other than the Mixed PlatformsRelease path, but this won’t change between build projects). If you set up deployment projects for staging and production you will end up with 3 deployed websites (development, staging and production). Nice!
Obviously for the build to include the script changes you just made you need to check the file back in to source control.
Hope this clears things up.









[...] Making Team Build and Web Deployment Projects play nice: Part 2 Filed under: .net, CI, tfs — Tags: .net, CI, tfs — andrewmyhre @ 10:02 pm 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. [...]
Making Team Build and Web Deployment Projects play nice: Part 2 « No Free Time
18 Nov 08 at 11:36 pm edit_comment_link(__('Edit', 'sandbox'), ' ', ''); ?>
Great post..Keep them coming
Thanks for sharing.
ScriptoManiac
5 Dec 09 at 10:25 pm edit_comment_link(__('Edit', 'sandbox'), ' ', ''); ?>
I am using the same procedure as you described but i have to include deployment project as well else i miss a single assemble file (generated against for the web page code behind files ascx.vb/.cs, aspx.vb/.cs files)
[Notice that within the _PublishedWebsites folder are two folders: ‘Website’ and ‘Website_deploy’. In this example they are identical; if I had set up custom web config replacements then in the ‘Website_deploy’ folder would be a customised web.config file.
If I hadn’t created a web deployment project, the Team Build would still create the ‘Website’ folder and deploy a compiled website. ]
The WebSite FOlder contains satellite assemblies like App_web_*****.dll. On the contrary, Website_Deploy Folder contains a single compiled Assembly like website.deploy.dll instead of the 20-30 satellite assemblies.
If deployment project were not there in the solution file, only the Website folder is created inside _PublisheWebsites fodler. But what to do of satellite assemblies like app_web_dll? Each of these assemblies correspond to aspx.vb and ascx.vb files from the Asp.Net website.
Kindly help.
Thanks
Awais
18 Jun 10 at 10:48 am edit_comment_link(__('Edit', 'sandbox'), ' ', ''); ?>