Pär 0 Comments

I tried for a while to get a Web Deployment Project to work together with a Web Application Project to get an automated deployment by my TFS/Team Build, but I ran out of patience. It worked on my local machine, but on the build machine it didn't work at all. Instead I decided to manually edit the WAP project file and it turned out that it was quit easy to accomplish an automated deployment in that manner.

All I have to do is to hook up to the "AfterBuild" target and do some copying:

<Target Name="AfterBuild" Condition=" '$(Configuration)|$(Platform)' == 'Deploy.Dev|AnyCPU'">
    <Message Text="Latest build deployment to @(LatestBuildDir)" />
    <Exec Command="xcopy &quot;$(ProjectDir).&quot; &quot;@(LatestBuildDir)&quot; /y /s /f" />
    <Exec Command="xcopy &quot;$(OutDir).&quot; &quot;@(LatestBuildDir)bin\&quot; /y /f" />
 </Target>

I started with creating a special configuration (Deploy.Dev) to be built on the build sever, I dont want to do this on the team developer machines, and I dont want to do this on each checkin either. I configured my Team Build to do this every night.  Then just defining the directories and do some xcopy. It will probable lead to some problems in more complex scenarios, but for my project it works just fine, and with not that much of an effort.