I found several articles on how to integrate Wix with MSBuild, but none were about using Wix with Team Build. In most of the cases, the msbuild looked like this:
<propertygroup>
<toolpath>C:\Program Files\Wix\</toolpath>
<outputname>MyProjectSetup</outputname>
<outputtype>package</outputtype>
</propertygroup>
<itemgroup>
<compile include="MyProject.wxs">
</compile>
<import project="$(ToolPath)wix.targets">
I added MyProject.wxs (the wix file) in the build type directory and modified TFSBulid.proj and added the above text. The build was not successful of course :) .
After a carefully examining the log files, I noticed that the wix.targets project overrode some tasks and some properties defined in Microsoft.TeamFoundation.Build.targets file. The solution was to change all properties and targets from wix.targets file like this:
from <target name="Compile"> to <target name="WixCompile">, from BuildDependsOn property to WixBuildDependsOn, and so on...
The final step was to call the WixBuild target from AfterDropBuild overriden target.
The final msbuild script looked like this:
<target name="AfterDropBuild">
...
<calltarget targets="WixBuild">
</calltarget>
<propertygroup>
<toolpath>C:\Program Files\Wix\</toolpath>
<outputname>MyProjectSetup</outputname>
<outputtype>package</outputtype>
</propertygroup>
<Itemgroup>
<Wixcompile include="MyProject.wxs">
</ItemGroup>
<import project="$(ToolPath)wix.targets">
Everything works just fine now, and we are able to include in the continuous integration process the deployment and setup packages consruction.